summaryrefslogtreecommitdiffstats
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* Cap logging level to the valid boundsHEADmasterFrediano Ziglio2016-03-111-1/+2
| | | | | | | Avoid overflows using its values. The patch was originally written by Christophe Fergeau Acked-by: Victor Toso <victortoso@redhat.com>
* Remove 2 unused vfuncs from client_marshallers.hChristophe Fergeau2016-03-111-2/+0
| | | | | | The AudioVolume and AudioMute messages are not sent by the client, so they do not need to appear in SpiceMessageMarshallers in client_marshallers.h
* Revert "Remove files moved to spice-protocol"Marc-André Lureau2016-03-101-21/+21
| | | | | | | | | | | | | | | | This reverts commit 7665dcf1bb2fa0b16b3d0015b28d7f5912664c3f. Also revert the related build-sys changes to fix the build. codegen generated code depends on spice-common code (marshaller, messages etc), it makes more sense to keep the generator along this. Otherwise a newer protocol release will fail to build older projects. *.proto files are required as well, since it generates code that parent modules depend on unconditionnaly. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* marshaller: fix uninitialized field usageFrediano Ziglio2016-02-031-0/+1
| | | | | | | has_fd was not initialized. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Marc-André Lureau <mlureau@redhat.com>
* marshaller: track if add_fd() was given -1Marc-Andre Lureau2016-02-022-9/+17
| | | | | | | | | In some cases, it might be worth to be able to send a message with a -1 fd, has the protocol permits. Change add_fd/get_fd in order to track if the caller wanted to send -1. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
* Use code to compute a bit maskFrediano Ziglio2016-01-271-11/+2
| | | | | | | Code is in the slow path, this reduce space needed for data+code. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* Avoid to call ceil_log_2 twice with same valueFrediano Ziglio2016-01-271-2/+2
| | | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* ConstificationFrediano Ziglio2016-01-271-1/+1
| | | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* zeroLUT has same content of lzeroesFrediano Ziglio2016-01-271-25/+2
| | | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* common: constify some declarationsFrediano Ziglio2016-01-273-4/+7
| | | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* small spice_strdup optimizationFrediano Ziglio2016-01-261-2/+4
| | | | | | | | avoid to compute the string length twice and use memcpy instead of strcpy which is faster not having to check for terminator. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* remove wrong statement terminator from preprocessor macroFrediano Ziglio2016-01-261-1/+1
| | | | | | | | Actually not causing problems as when used is always followed by another terminator but better to fix the definition. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* log: Kill spice_warn_ifChristophe Fergeau2016-01-261-6/+0
| | | | | | It's redundant with spice_warn_if_fail(), and can even be confusing. Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* log: Use glib for loggingChristophe Fergeau2016-01-262-60/+112
| | | | | | | | | | | | | spice-common has been duplicating glib logging methods for a long while. Now that spice-common is depending on glib, it's more consistent to use glib logging too. However, the code base is still using spice logging functions. This commit aims to make spice logging go through glib logging system, while keeping the same behaviour for the SPICE_ABORT_LEVEL and SPICE_DEBUG_LEVEL environment variables. They are deprecated however in favour of the glib alternatives (G_DEBUG and G_MESSAGES_DEBUG). Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
* log: Remove unneeded #ifdef/#endifChristophe Fergeau2016-01-261-26/+0
| | | | | | | | | If header guards are working as expected, there should not be multiple definitions of these macros. If they are redefined somewhere else, this is a bug we want to fix. Acked-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* log: Use more glib macrosChristophe Fergeau2016-01-211-34/+33
| | | | | | No need to have our own SPICE_STMT_BEGIN/END and SPICE_STRINGIFY Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* draw: Add spice_image_descriptor_is_lossyPavel Grunt2016-01-202-6/+8
| | | | | | It will be used in the server code Acked-by: Frediano Ziglio <fziglio@redhat.com>
* Add GL scanout structuresMarc-Andre Lureau2016-01-142-0/+20
| | | | | | | See related protocol changes. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
* marshaller: learn to describe fd passing in messagesMarc-Andre Lureau2016-01-142-0/+27
| | | | | | | | | | | | | The marshaller can't serialize fd in memory stream. Instead, append the fd to the marshaller structure. The marshaller user is responsible for sending the fd when the message is sent. The fd to send can be retrieved with spice_marshaller_get_fd(). Note: only a single fd is supported with this API, supporting multiple fd is left for the future if it becomes necessary. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
* ring: use NULL instead of 0 for null pointersFrediano Ziglio2016-01-071-1/+1
| | | | | | | | | This is consistent with the rest of the code making clear fields are pointers. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Uri Lublin <uril@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
* Remove headers that are included in spice_common.hVictor Toso2016-01-079-27/+5
| | | | Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
* Remove trailing whitespaceLukas Venhoda2015-12-184-9/+9
|
* ppc: Fix alpha state checking on BE machinesLukas Venhoda2015-12-171-0/+3
| | | | | The surface before conversion can be either LE or BE on a BE machine. Check against both BE and LE color order on BE machine.
* ppc: Fix colors on ppc when using jpegLukas Venhoda2015-12-171-2/+2
| | | | Fixes color order on PowerPC when using jpeg compression.
* ppc: Fix colors on ppc when using LZ4Lukas Venhoda2015-12-171-3/+3
| | | | Fixes color order on PowerPC when using LZ4 image compression.
* ppc: Fix colors on ppc when using LZLukas Venhoda2015-12-171-3/+3
| | | | Fixes color order on PowerPC when using LZ image compression.
* ppc: Fix colors on ppc when using QUICLukas Venhoda2015-12-171-3/+3
| | | | Fixes color order on PowerPC when using QUIC image compression.
* ppc: Add support for bigendian color byte orderLukas Venhoda2015-12-171-0/+14
| | | | | | | | | | | On LE machine, color order when creating surface will always be A/XRGB. On BE machines the color order will sometimes be ARGB and sometimes BGRA/X. This is because we actually create the surface two times on BE machines. Once with BE order, and then again with LE order. Copying data inbetween theese two surfaces will byteswap the colors automatically. This change introduces cases for BGRA/X color byte orders on BE machines.
* pixman_utils: Use PIXMAN_LE_ constants in spice_bitmap_try_as_pixman()Lukas Venhoda2015-12-171-15/+3
| | | | | | After the previous commit, spice_bitmap_try_as_pixman() can be simplified as its #ifdef WORDS_BIGENDIAN exactly match what the PIXMAN_LE_ constants do.
* pixman_utils: Add macros for color byte orderingLukas Venhoda2015-12-171-0/+10
| | | | | | | | | | When using image compression on PowerPC architecture, colors are in wrong order ARGB -> BGRA. This commit introduces macros, that will change the color order according to machine endianness. Theese macros are similar to QEMU macros in qemu-pixman.h
* ssl-verify: Don't leak GInetAddressChristophe Fergeau2015-11-271-2/+8
| | | | | GInetAddress is a GObject, so we must unref anything we create with g_inet_address_new_*
* ssl-verify: Handle NULL return from g_inet_address_new_from_string()Christophe Fergeau2015-11-271-2/+6
| | | | It will return NULL if the string we pass it cannot be parsed.
* Use new libcacard.h if possibleMarc-André Lureau2015-11-251-1/+5
| | | | | | | | | libcacard.h requires 2.5.1. Keep compatibility for older versions until the transition in distros to the standalone version is done. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> [ Christophe: add < 2.5.1 fallback ] Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
* canvas_base: Remove redundant switch case blockLukas Venhoda2015-11-241-4/+1
|
* build-sys: Rename SUPPORT_GL to HAVE_GLChristophe Fergeau2015-10-231-1/+1
| | | | | The other conditionals are using the HAVE_ prefix, using HAVE_GL rather than SUPPORT_GL improves consistency.
* ssl-verify: Changed IPv4 hostname to IPv6Lukas Venhoda2015-10-231-24/+21
| | | | | | | | Change inet_aton function to glib functions. inet_aton only supported IPv4 addresses, and wasn't available on windows machines. GInetAddress functions support IPv6 natively, and requires less boilerplate code then IPv6 gettaddrinfo().
* ssl-verify: Only check addr length when using IP addrLukas Venhoda2015-10-231-7/+8
| | | | | Only check for address length, when connecting through IP address. It is not used, when connecting through DNS hostname.
* Fix linearization of several marshallers with one itemJavier Celaya2015-09-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | The linearization optimization that avoids copying only one item must check that there are no further marshallers in the chain. Just to be clear, we are trying to marshall a message like this: message { uint32 data_size; uint64 *data[data_size] @marshall; } SomeData; Where the data field points to an array in dynamic memory. Marshalling and demarshalling functions look good. The marshalling function creates a submarshaller for the data field and links it to the root marshaller. But when it comes to sending the data through the wire, only the data_size field gets sent. We have observed that, in spice_marshaller_linearize, execution enters into the optimization that avoids copying the data when the root marshaller only has one item, but it ignores the following marshallers in the list. Checking if there are more marshallers fixes the problem.
* common: Fix typo in commentFrediano Ziglio2015-08-141-1/+1
| | | | Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
* Use installed spice-protocol for code generationChristophe Fergeau2015-08-111-29/+23
| | | | | | Now that spice-protocol ships the needed .proto files as well as the corresponding python scripts, spice-common can use these in order to generate the C code for the SPICE (de)marshallers.
* ppc: Fix quic magic endianessLukas Venhoda2015-07-021-1/+2
| | | | | | | | | Runtime conversion from a string to uint32 is storing the magic with the same endianness on both LE and BE machines. This requires aditional byte swap when sending magic between LE/BE machines. Changing quic magic to a constant will ensure, that it will be always stored in native endianness, and the second byte swap won't be needed.
* ppc: Fix lz magic endianessLukas Venhoda2015-07-022-4/+3
| | | | | | | | | | | | | | Commit d39dfbfe changes lz magic to be always treated as LE when encoded. Runtime conversion from a string to uint32 is storing the magic with the same endianness on both LE and BE machines. This requires aditional byte swap when sending magic between LE/BE machines. Changing lz magic to a constant will ensure, that it will be always stored in native endianness, and the second byte swap won't be needed. This commit reverts d39dfbfe changes in lz.c while keeping the rest. They will be needed in future commit for quic.c
* ppc: Fix quic decode endianessLukas Venhoda2015-07-021-3/+5
| | | | | Converts all decoded words in quic from little endian to local machine endianness.
* Proto: Add preferred compression message and constants.Javier Celaya2015-06-222-0/+5
| | | | | | | | | When accessing a virtual desktop from different devices, some may have different image compression requirements, e.g. slow devices may prefer the faster LZ4 over GLZ. This message instructs the server to switch the image compression algorithm. This patch also promotes the SPICE_IMAGE_COMPRESS_* constants so that they are available from both the server and the client.
* ppc: Fix lz magic endiannessErlon Cruz2015-04-101-1/+3
| | | | | | Signed-off-by: Erlon R. Cruz <erlon.cruz@br.flextronics.com> Signed-off-by: Rafael F. Santos <fonsecasantos.rafael@gmail.com> Signed-off-by: Fabiano Fidêncio <Fabiano.Fidêncio@fit-tecnologia.org.br>
* ssl_verify: Move wincrypt.h related #ifdef closer to the includeChristophe Fergeau2015-03-261-4/+4
| | | | | | | | | Both wincrypt.h and openssl try to define X509_NAME. The wincrypt.h one is not useful for us, so we currently #undef it if this was set. However, it's done very late, right before including x509v3.h which defines the X509_NAME type. Any header included in between may try to #include x509v3.h so it's better to undefine X509_NAME right after including wincrypt.h.
* Get rid of SW_CANVAS_IMAGE_CACHEChristophe Fergeau2015-03-266-42/+14
| | | | | | | | | | | | | | | | | | | | Every time it's used, it's in constructs similar to: #ifdef SW_CANVAS_CACHE , SpiceImageCache *bits_cache , SpicePaletteCache *palette_cache #elif defined(SW_CANVAS_IMAGE_CACHE) , SpiceImageCache *bits_cache #endif This can be rewritten as: , SpiceImageCache *bits_cache #ifdef SW_CANVAS_CACHE , SpicePaletteCache *palette_cache #endif allowing to get rid of SW_CANVAS_IMAGE_CACHE.
* Remove another redundant (SW_CANVAS_CACHE) || (SW_CANVAS_IMAGE_CACHE) #ifdefChristophe Fergeau2015-03-261-2/+0
|
* Fix typo in pixman_image_get_stride() functionFabiano Fidêncio2015-02-251-1/+1
| | | | pixman_image_surface_get_stride -> pixman_image_get_stride
* LZ4: Do not include arpa/inet.h in Windows buildsJavier Celaya2015-02-031-0/+2
|