Commit Graph

425 Commits

Author SHA1 Message Date
Fabiano Fidêncio
fbdd4e41c0 common: Fix -Wmissing-field-initializers 2014-09-18 13:15:35 +02:00
Fabiano Fidêncio
6f3918ce7c common: Fix -Wsign-compare 2014-09-18 13:15:34 +02:00
Fabiano Fidêncio
c8b4c5ec49 common: Fix -Wunused-parameter 2014-09-18 13:15:29 +02:00
Fabiano Fidêncio
dde1c62a91 common: Remove dead code 2014-09-18 13:15:26 +02:00
Fabiano Fidêncio
840bcfe7a2 python: Fix -Wsign-compare
The return of the get_array_size() is used as a limit in a loop,
being compared with an unsigned index (indexes are always unsigned).
To avoid the -Wsign-compare warning, let's cast the return of the
get_array_size() to unsigned and make GCC happier.
2014-09-18 13:13:30 +02:00
Fabiano Fidêncio
9385db6875 python: Fix -Wunused-parameter
Although the most part of the parameters marked as unused are actually
being used for a few functions, a bunch of warnings can be seen when
the code is compiled with "-Wall -Wextra". As adding the unused attribute
means that the variable/parameter is meant to be *possibly* unused, we're
safe adding it in the generated code, even for used variables/parameters.
2014-09-18 13:13:27 +02:00
Fabiano Fidêncio
d45b3e2765 quic_family_tmpl: Fix "FORWARD_NULL" caught by coverity
Ensure the received bucket is non NULL
2014-07-23 17:20:30 +02:00
Fabiano Fidêncio
7e4cfbe305 quic: Fix "UNINIT" caught by coverity
In case of the model evolution mode has a obsolete or non-valid value,
just return, avoiding then the usage of non initalized variables.
2014-07-23 17:20:30 +02:00
Fabiano Fidêncio
2c5041c3f8 quic: Fix melcstate "OVERRUN" caught by coverity
Check for MELCSTATES - 1 to get inside the branch, otherwise
(...)->rgb_state.melcstate may be up to MELCSTATES after the
pre-incrementing, which would result in an access to a position
that is out bounds of the array size MELCSTATES.
2014-07-14 19:26:33 +03:00
Marc-André Lureau
dd4a446f5d demarshal: prefix variable name with parent names
Avoid naming clash if parent structures have the same name

https://bugzilla.redhat.com/show_bug.cgi?id=1021995
2014-05-15 14:21:48 +02:00
Christophe Fergeau
60046b309d Mark sw_canvas.[ch] as automake source files
These 2 files are not build as part of spice-common
build system, but modules using spice-common will build
them with the appropriate options. We need to let automake
know that these are source files so that it can properly
track these files dependencies.

Without this change, when eg spice-gtk switches to use 'subdir-objects'
to build sw_canvas.c as recommended by automake 1.14, the build
will fail because $(top_srcdir)/spice-common/common/.deps/sw_canvas.Plo
will not have been generated.
2014-05-07 13:01:12 +02:00
Christophe Fergeau
b3a00f4411 marshaller: Use #include <> for headers in $srcdir/common
Since the (de)marshallers are now generated in $builddir and not in
$srcdir, when these generated files include a file located in
$srcdir/common, the compiler will find them thanks to a -I directive, so it
makes more sense to use <> rather than "" when including them.
2014-04-16 16:47:55 +02:00
Christophe Fergeau
90a1240f27 Use #include "common/..." in (de)marshallers
Now that they are created in $builddir, their includes will need to refer
to files in $srcdir, which can be different. It's cleaner to add
-I $(top_srcdir)/spice-common/ to modules using spice-common rather than
having -I $(top_srcdir)/spice-common/common which would could create header
collisions.
2014-04-16 16:47:55 +02:00
Christophe Fergeau
7ea1cc54b1 Fix generation of marshallers in VPATH builds
The rules to generate the .c/.h (de)marshalling files have targets based in
$builddir, but the CLIENT_MARSHALLERS/SERVER_MARSHALLERS list refer to
files in $srcdir.
When using a $srcdir != $builddir, these $srcdir files will not exist, and
it will not be possible to generate them, which causes the build to fail.

When using $srcdir == $builddir from git or from tarballs, this will not
make a difference. When building from git, if $srcdir and $builddir are the
same, then the files will be found regardless of if we look for them in
$srcdir or $builddir as they are the same.
In tarballs, the files will be shipped with the tarball and thus available
in $srcdir. As $builddir is the same as $srcdir, the files will already
exist and not be regenerated.

The only change of behaviour will be when using a tarball and doing a
$srcdir != $builddir build. In this case, the files will need to be
regenerated, so the tools needed for that must be installed on the
machine doing the build.
2014-04-16 16:47:55 +02:00
Marc-André Lureau
6edeb43747 Update spice-protocol 2014-03-19 17:56:04 +01:00
Marc-André Lureau
01955e7007 spice.proto: add webdav channel
This channel provides a webdav server (rfc4918). This allows various
guest or remote system that support webdav to access a folder shared by
the client (some agent can be used to proxy the requests on a local port
for example). The webdav server may also be accessed by an hypervisor as
a remote filesystem interface, which can then be accessed by the guest
via other means (fs/fat emulation, mtp device, etc)

Due to the usage of a single channel stream and the need for concurrent
requests, webdav clients streams are multiplexed. Each client stream is
framed within 64k max messages (in little-endian)

 int64    client_id
 uint16   size
 char     data[size]

A new client_id indicates a new connection. A new communication stream
with the webdav server should be started. A client stream message of
size 0 indicates a disconnection of client_id. This multiplexed
communication happens over the channel "data" message.

Only when the port is opened may the communication be started.
A closed port event should close all currently known multiplexed
connections.

Why WebDAV?

webdav is supported natively by various OS for a long time (circa
Windows XP). It has several open-source implementations and a variety of
tools exist. A webdav implementation can be tested and used without a
Spice server or any virtualization (this also permit sharing the
implementation with other projects in the future, such as GNOME). It is
an IETF open standard and thus thoroughly specified.

The basic requirements for an efficient remote filesystem are provided
by the standard (pipelining, concurrency, caching, copy/move, partial
io, compression, locking ...) While other features are easily possible
via extensions to the protocol (common ones are executable attributes,
or searching for example).

Given the requirements, and the popularity of http/webdav, I believe it
is the best candidate for Spice remote filesystem support.

Other alternatives (adhoc, p9, smb2, sftp) have been studied and
discarded so far since they do not match in term of features or
requirements.
2014-03-19 14:47:04 +01:00
Christophe Fergeau
96ca358669 quic: Fix test which is always true
find_model_params() is first doing *nbuckets = 0; and it then checks
nbuckets for NULL. This is redundant as the dereferencing would cause a
segfault if nbuckets was NULL, so the if (nbuckets) test can't be false.
As Uri pointed out, the "/* bucket start */" comment on the same line
probably implies that the test was meant to be 'if (*nbuckets)'
I've ran a few test and I did not observe issues because of it...
2014-01-20 14:33:33 +01:00
Christophe Fergeau
6175014ed7 ssl: Don't use uninitialized variable in verify_subject()
If verify_subject() is called with a SpiceOpenSSLVerify struct containing a
non-NULL 'in_subject' member, it would try to use the local 'in_entries'
variable without having initialized it first. This could happen if
verify_subject() was called multiple time with the same SpiceOpenSSLVerify
context, which probably isn't occurring the way we are using it.

However, since verify_subject() is the only method which needs in_subject,
we don't need to have it stored in SpiceOpenSSLVerify, and we can
recreate it as needed locally in that method, which avoids that issue.
2014-01-07 13:55:58 +01:00
Christophe Fergeau
a4f4ddf56c mi: Fix shadow warnings
Based off a xserver commit from Yaakov Selkowitz:
http://cgit.freedesktop.org/xorg/xserver/commit/mi/mispans.c?id=f02e27e4fcc34413b2051e5a01edc92172fa8612
2014-01-07 13:55:51 +01:00
Christophe Fergeau
ae39a05620 mi: fix memory leak in miFillUniqueSpanGroup
This is based off the corresponding xserver commit from Tiago Vignatti:
http://cgit.freedesktop.org/xorg/xserver/commit/mi/mispans.c?id=7ae46b69ba3f05f46529131e6a864904967cde3a

Since xrealloc is #defined to spice_realloc which aborts on failure, this
block is dead code, but I prefer to stay as close as possible to the
upstream xserver code this is based on.
2014-01-07 13:55:51 +01:00
Christophe Fergeau
d8e49b71d4 mi: Avoid stack smash when drawing dashed lines
Based off Peter Harris's xserver commit
http://cgit.freedesktop.org/xorg/xserver/commit/mi/miwideline.c?id=20c2a3bcb11b5baf564e2c73a477ba23f5ae2b10
2014-01-07 13:55:51 +01:00
Christophe Fergeau
ead4b8810a quic: Add missing break; in switch/case
Unhandled values call an error callback, and then fall through the default:
case, which will call again the error callback. This commit adds some
break; after these cases to avoid this.
2014-01-07 13:55:51 +01:00
Christophe Fergeau
793e5d0350 backtrace: Don't attempt to call seteuid(0)
We are mostly likely not running as root, so this call will fail. As we are
supposed to check its return value as it's declared with
warn_unused_result, the current way of using it is wrong, so this commit just
removes the call.
2014-01-07 13:55:50 +01:00
Christophe Fergeau
6674e1c136 Remove unused variable
It was assigned a value, but then the value was never used.
2014-01-07 13:55:50 +01:00
Jeremy White
57ce430ccd Add support for the Opus codec.
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2014-01-02 12:28:21 +01:00
Jeremy White
c108e4ee8c Add a snd_codec interface to abstract the use of audio codecs such as celt.
Signed-off-by: Jeremy White <jwhite@codeweavers.com>
2014-01-02 12:25:23 +01:00
Marc-André Lureau
261d270cc8 Update spice-protocol 2013-11-19 17:46:56 +01:00
Jonathon Jongsma
1450bb4ddb Be explicit about spice-common license
Use same license as spice-gtk and spice modules (LGPL 2.1) since those licenses
applied to the spice-common submodule in the past.  This makes it more clear
that if you use spice-common separately, the license is still LGPL.  Also
mention license and copyright in generated files.
2013-10-23 11:41:43 -05:00
Jonathon Jongsma
31ef0c626d codegen: Add a --generate-wireshark-dissector option
The wireshark protocol dissector is a bit out-of-date. Several new channel types
and enums have been added.  It would be nice if these values (and the
translation between the value and the name) could be automatically generated so
that updating the dissector was a slightly less manual process.  This patch adds
a commandline switch which generates both the enums and value-name lists in the
format that wireshark expects.
2013-10-23 11:41:43 -05:00
Christophe Fergeau
fa640286f4 ssl: Don't try hostname check if cert subject check fails
Currently, SSL verification of the peer certificate checks if
the certificate's subject CN or one of its subjectAltName match
the hostname. If this succeeds, then the verification succeeds.
Otherwise openssl_verify() checks the cert subject if this was set,
which means it checks the certificate's subject (not just its CN) matches
exactly the cert subject string that is set in SpiceSession.

Given that the cert subject is something the user specifies in addition
to the hostname, the cert subject check should have priority over the
hostname check, that is, when we have a cert subject set, the
success/failure of the cert subject cert should determine the
success/failure of openssl_verify(), and the hostname check
should only be carried out when no cert subject was set.

This fixes rhbz#871034
2013-10-11 10:21:54 +02:00
Christophe Fergeau
9b3e972cdc ssl: Log an error when peer certificate verification failed
We currently log an error when openssl_verify() is called with
preverify_ok set to 0 for all certificates in the certificate chain
except for the peer certificate (when 'depth' is 0).
This commit logs an error in the latter case as well.
2013-10-11 10:21:54 +02:00
Christophe Fergeau
b34169feb6 ssl: Improve error message in cert chain verification
It contains the same information as before, but should be more readable.
2013-10-11 10:21:54 +02:00
Marc-André Lureau
7e8ba10779 Remove INLINE usage
Since inline is c99 and its already used in some files
2013-10-04 12:45:00 +02:00
Marc-André Lureau
e443c9f603 gl: use glCopyPixels()
I don't see why the fallback method should be the default.

glCopyTexImage2D and glCopyPixels are equally broken with current Intel
mesa/drivers (I'll be filing a bug). But sw rendering is correct.
2013-09-30 02:18:37 +02:00
Marc-André Lureau
0aadda70d5 gl: cope with positive stride in put_image()
Keeping the warning, because I don't think this should happen anyway.
2013-09-30 02:18:37 +02:00
Marc-André Lureau
b6faccb381 gl: ignore alpha channel in draw_copy
Similar to sw canvas blit copy operation, and not a blend.
2013-09-30 02:18:37 +02:00
Marc-André Lureau
370ba35339 gl: ignore if mask has not bitmap
Similar to how sw canvas ignore mask if !bitmap in canvas_mask_pixman().
2013-09-30 02:18:37 +02:00
Marc-André Lureau
f88e851ed6 build-sys: add --enable-smartcard=auto
Use same implementation as spice-gtk, to avoid need to explicitely set
smartcard support
2013-09-26 19:03:31 +02:00
Marc-André Lureau
3363fe79f9 Update spice-protocol 2013-09-12 13:52:27 +02:00
Marc-André Lureau
4857653686 quic: precompute golomb codes
We can avoid repetitive computation by using two precomputed array, of
8k each.

before:
     1.79%  lt-spicy-stats  libspice-client-glib-2.0.so.8.4.0  [.]
     golomb_code_len_8bpc

after:
     0.79%  lt-spicy-stats  libspice-client-glib-2.0.so.8.4.0  [.]
     golomb_code_len_8bpc
2013-09-12 13:49:25 +02:00
Marc-André Lureau
8db88d2854 quic: compile with constant bpp
This simplifies a little bit function calling, and allows for compiler
to potentially specialize and optimize a bit better each version.
2013-09-12 13:49:25 +02:00
Marc-André Lureau
a7b93bd43d canvas: use precomputed revers_bits
Thos function shows up in some profiling results, it seems we can
trivially replace it with a precomputed array of 256bytes.

before:
     5.66%           691  lt-spicy-stats
libspice-client-glib-2.0.so.8.4.0  [.] revers_bits

after:
     0.53%            64  lt-spicy-stats
libspice-client-glib-2.0.so.8.4.0  [.] revers_bits
2013-09-12 13:49:25 +02:00
Marc-André Lureau
6440a1e533 proto: add fake last message in base channel
Make it explicit that 100 is the last value of the base channel
messages. This allows clients to use the generated enum value too.
2013-09-12 13:49:25 +02:00
Marc-André Lureau
4d8d2b6124 proto: comment future surface flags usage 2013-09-12 13:49:25 +02:00
Christophe Fergeau
ffc3e8a327 Fix min gcc version for __attribute__(format)
We currently use it only on gcc 4.5 or newer, but it was actually
introduced much earlier than that. It's documented in gcc 2.95.3
manual:
http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#SEC84
and glib uses starting from gcc 2.2.5.
This commit uses the same minimum version as glib.

This was causing warnings on RHEL6 systems which have gcc 4.4.7
2013-08-20 10:38:07 +02:00
Uri Lublin
fe93908238 Update spice-protocol to 0.12.6 2013-07-10 17:53:20 +03:00
Hans de Goede
fc27fb20b8 Update spice-protocol
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-06-24 13:27:37 +02:00
Yonit Halperin
30e84783ca add SPICE_MSG_PLAYBACK_LATENCY
SPICE_MSG_PLAYBACK_LATENCY is intended for adjusting the
latency of the audio playback. It is used for synchronizing
the audio and video playback.
The corresponding capability is SPICE_PLAYBACK_CAP_LATENCY.
2013-04-22 11:34:49 -04:00
Yonit Halperin
7cdf8de00a add stream report messages
If the server & client support SPICE_DISPLAY_CAP_STREAM_REPORT,
the server first sends SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT. Then,
the client periodically sends SPICE_MSGC_DISPLAY_STREAM_REPORT
messages that supply the server details about the current quality of
the video streaming on the client side. The server analyses the
report and adjust the stream parameters accordingly.
2013-04-22 11:34:20 -04:00
Christophe Fergeau
5ebeee5114 Add compile-time check for lz arrays
In addition to Laszlo's commit fixing rhbz#928973, we can add
some compile-time assertion to lz_common.h to help catch similar
bugs in the future.
This uses gnulib's verify.h to make sure at compile-time that
the various constant arrays used in lz_common.h are of the expected
size.
I've checked that before Laszlo's patch, the assert triggers, and
that it's gone after it.
2013-04-10 09:53:51 +02:00