Commit Graph

2156 Commits

Author SHA1 Message Date
Jonathon Jongsma
21c6da814a Change RedCharDevicePrivate::clients to GList
More Ring cleanup. At the moment, we only support a single client, so
this is only a one-element list
2016-09-19 07:47:05 -05:00
Jonathon Jongsma
8340688c9d Change RedCharDevice::write_queue to GQueue
Change a couple more Rings to GQueue
2016-09-19 07:47:05 -05:00
Jonathon Jongsma
039d3150ab Change Drawable->pipes from Ring to GList
This improves the readability of the code and keeps things
encapsulated better.
2016-09-19 07:47:05 -05:00
Jonathon Jongsma
a78a7d2510 RedChannelClient: store pipe items in a GQueue
Instead of using a Ring (and having a ring item link in every pipe
item), store them in a GQueue. This also necesitated changing
RedCharDeviceVDIPort->priv->read_bufs to a GList as well.

Also Optimise client pipe by passing pipe position instead of data.
This avoids having the search the data scanning all the queue changing
the order of these operations from O(n) to O(1).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-19 07:47:05 -05:00
Jonathon Jongsma
46c83dfe1f Rename display_channel_set_monitors_config_to_primary()
Since this function is a DisplayChannel method, use a name consistent
with naming conventions.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-16 13:40:09 -05:00
Jonathon Jongsma
5e74387d25 Add DisplayChannelPrivate struct
Move all of the DisplayChannel data memembers into a private struct to
encapsulate things better. This necessitated a few new 'public' methods
and a small bit of refactoring to avoid poking into DisplayChannel
internals from too many places. The DisplayChannel and the
DisplayChannelClient are still far too intertwined to completely avoid
accessing private data, so at the moment the private struct is defined
in display-channel.h and the DisplayChannelClient implementation
still accesses it sometimes.
2016-09-16 13:40:09 -05:00
Jonathon Jongsma
fede3f38c5 Improve encapsulation of DisplayChannel
Add a couple new functions to the header so that they can be called by
other objects rather than poking into the internals of the struct.
2016-09-16 13:40:09 -05:00
Pavel Grunt
83ff645d54 reds: Simplify vdi_port_read_buf_process
Reuse and handle the return value from agent_msg_filter_process_data

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-16 12:21:06 +01:00
Frediano Ziglio
b0528f334a replay: Rename eof to error
The eof variable and enumeration will be used for all errors
so avoid confusion.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-16 12:06:19 +01:00
Frediano Ziglio
bd8ccfcd78 replay: Assure read_binary receives a NULL pointer
read_binary do not allocate a buffer for no-NULL pointers.
Avoid using uninitialized data and allocate proper buffer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-16 12:00:27 +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
Frediano Ziglio
80b1e816c6 Remove unused drawable parameter
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-16 09:29:19 +01:00
Frediano Ziglio
57dfbebaa9 Reduce indentation
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-16 09:17:10 +01:00
Frediano Ziglio
5ccad56915 Simplify some boolean arithmetic
Pass boolean directly.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-16 09:14:24 +01:00
Jonathon Jongsma
b6cbb26e25 Replace a couple Rings with GList
Make RedsState::mig_target_clients into a GList to improve encapsulation
and maintainability. Also RedsMigTargetClient::pending_links. With
GList, a type implementation can be ignorant of whether they're
contained within a list or not.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-16 08:49:59 +01:00
Jonathon Jongsma
b08f132102 Make glz_dictionary_list a GList
Removing more intrusive RingItems from various structures and improving
readibility.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-15 16:06:34 +01:00
Jonathon Jongsma
867bee66a7 Add CursorChannelPrivate struct
Encapsulate private data of CursorChannel in a private struct. This
isn't very useful at the moment, but it will help prepare the way for
porting the RedChannel heirarchy to GObject.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-15 15:34:31 +01:00
Uri Lublin
4cb02250f4 dcc_compress_image: fix a possible overflow when calculating image_size
Both src->stride and src->y are uint32_t
Fixed by making one of them uint64_t

Found by coverity

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-15 15:16:27 +01:00
Uri Lublin
37e4cae9d4 dcc_gl_draw_item_new: allocate item when needed
Prevents a leak on early return.

Found by coverity.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-15 15:16:25 +01:00
Uri Lublin
dc6c57668a dcc_gl_scanout_item_new: allocate item when needed
Prevents a leak on early return.

Found by coverity.

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-15 15:16:23 +01:00
Uri Lublin
42066f03ec dcc: do not check the pointer returned by spice_new
The rest of the code assumes spice_new does not return NULL

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-15 15:16:00 +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
Frediano Ziglio
0f6ccd8af5 Remove global key_modifiers_timer variable
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-12 13:18:40 +01:00
Frediano Ziglio
9432b01663 Remove unused structure declaration
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-09-12 13:04:38 +01:00
Jonathon Jongsma
249d418d33 RedsState: clean up spice_server_char_device_add_interface
Previously we were creating a variable named 'dev_state' and then
apparently not using it. Well, we *were* actually using it, but in a
convoluted sort of way. Creating a new RedCharDevice has a
side-effect of setting itself as the 'st' attribute of
SpiceCharDeviceInstance. So 'dev_state' and 'char_device->st' are in
fact the same variable. But they were being used interchangeably, which
was rather confusing. For example

if (dev_state)
    // do something with char_device->st

So this patch doesn't actually change anything, but it makes the code a
bit easier to follow.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-09 15:09:37 +01:00
Christophe Fergeau
0ae0814696 Fix 'freezed' typo
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-09 14:56:31 +01:00
Jonathon Jongsma
8f1f60d46f Use RED_CHANNEL_CLIENT() macro for casting
Also remove (main|inputs)_channel_client_get_base() function to prepare
for porting to GObject.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-08 11:41:57 +01:00
Victor Toso
f9c4f6da0e mcc: early return and lower indentation
main_channel_client_start_net_test() checks MainChannelClient already
which is the single reason why main_channel_client_push_ping() could
fail. Reorganizing this code a little bit.

Acked-by: Frediano Ziglio <fziglio@redhat.com
2016-09-08 10:04:14 +01:00
Victor Toso
b7353a0c61 mcc: early return and lower indentation
Acked-by: Frediano Ziglio <fziglio@redhat.com
2016-09-08 10:04:09 +01:00
Jonathon Jongsma
7188cefdd2 Rename RCC_TO_DCC() to DISPLAY_CHANNEL_CLIENT()
Prepare for port to GObject

Acked-by: Frediano Ziglio <fziglio@redhat.com
2016-09-08 09:40:15 +01:00
Jonathon Jongsma
82d4edc75a Add DisplayChannelClientPrivate and CursorChannelPrivate structs
These need to be introduced at the same time since cache-item.tmpl.c
assumes that both of these classes will have a cache in the same place:
either within the channel client struct itself or (now) within a priv
struct owned by the channel client.

This encapsulates private data and prepares for porting to GObject.

Acked-by: Frediano Ziglio <fziglio@redhat.com
2016-09-08 09:40:15 +01:00
Jonathon Jongsma
51ccb44af0 Add RedChannelClientPrivate struct
Encapsulate private data and prepare for port to GObject

Acked-by: Frediano Ziglio <fziglio@redhat.com
2016-09-08 09:40:15 +01:00
Jonathon Jongsma
aa2430e5ad Add MainChannelClientPrivate struct
Encapsulate private data and prepare for port to GObject

Acked-by: Frediano Ziglio <fziglio@redhat.com
2016-09-08 09:40:15 +01:00
Jonathon Jongsma
e8a8607f5f Add InputsChannelClientPrivate struct
Encapsulate private data and prepare for port to GObject.

Acked-by: Frediano Ziglio <fziglio@redhat.com
2016-09-08 09:40:15 +01:00
Jonathon Jongsma
9b1e018da6 Add SmartCardChannelClientPrivate struct
Prepare to port to GObject by encapsulating all private data

Acked-by: Frediano Ziglio <fziglio@redhat.com
2016-09-08 09:40:15 +01:00
Jonathon Jongsma
7dd8e8be76 Move CursorChannelClient to separate file
Acked-by: Frediano Ziglio <fziglio@redhat.com
2016-09-08 09:38:04 +01:00
Jonathon Jongsma
bed132d6e2 Move RedChannelClient to separate file
Reduce direct access to RedChannelClient, and get ready to convert to
GObject.

Acked-by: Frediano Ziglio <fziglio@redhat.com
2016-09-08 09:37:59 +01:00
Pavel Grunt
1796160095 tests: Check setting of agent properties
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-07 14:18:50 +02:00
Pavel Grunt
bf68b73ba6 reds: Do not crash when setting agent property
Agent properties like file transfer or copy & paste can be disabled by
calling spice_server_set_agent_{copypaste, file_xfer} before the spice
server is initialized. In that case the call crashes the server because
the agent device is created after the initialization.

To avoid the crash this commit introduce a helper function for setting
the agent properties after the server is initialized.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-09-07 14:18:05 +02:00
Jonathon Jongsma
d529bfd4f0 Use red_channel_client_get_stream()
Don't touch the rcc struct directly. Improve encapsulation to help
prepare for separating RedChannelClient to a separate file.
2016-08-30 16:53:29 -05:00
Jonathon Jongsma
66c5700602 Don't poke RedChannelClient::send_data from RedChannel
More preparation for separating RedChannelClient into a separate file.
Rename function slightly for improved readability:
 red_channel_client_blocked() -> red_channel_client_is_blocked()
2016-08-30 16:53:29 -05:00
Jonathon Jongsma
7b8087a71d Add red_channel_client_(set|is)_destroying()
Encapsulate the structure a bit more and avoid poking into it from other
class implementations. Getting ready to split RedChannelClient out to a
separate file.
2016-08-30 16:53:29 -05:00
Jonathon Jongsma
2fa1c1e3fd Use red_channel_client_get_client() everywhere
Instead of having all other classes poke into the RedChannelClient
struct to get the RedClient associated with the channel client, call the
accessor function. This commit allows us to encapsulate RedChannelClient
and move it to its own file soon.
2016-08-30 16:53:29 -05:00
Jonathon Jongsma
d5d59d0858 Add red_channel_client_get_channel()
Don't poke into the structure to get the channel

This prepares for encapsulating RedChannelClient a bit more and
separating it into its own source file.
2016-08-30 16:53:29 -05:00
Francois Gouget
d146793dd9 server: Use SPICE_GNUC_DEPRECATED to avoid a dependency on glib.h
spice-server.h cannot include glib.h because it is a public header and
is used by projects that do not use GLib.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-12 09:47:40 +01:00
Frediano Ziglio
319a31ad81 OpenSSL from 1.1.0 is thread safe by default
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-08-12 09:30:47 +01:00
Frediano Ziglio
7951a31756 Avoids to initialise OpenSSL threading twice
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-08-11 14:47:25 +01:00
Frediano Ziglio
a318f3e981 gstreamer: Use a dummy format to make sure format is always defined.
This avoid a check for NULL.
Also will be used to catch invalid values when table will be extended.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-08-11 14:47:25 +01:00
Frediano Ziglio
e58d22a37b Make process_commands_generation variable type coherent
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-08-11 14:12:21 +01:00
Frediano Ziglio
0a13066396 gstreamer: Peephole optimisation for SpiceFormatForGStreamer
Reduce structure length using static allocated string inside the
structure.
This will also avoid using .data.rel.ro section and relocations
reducing even more library size.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-08-11 14:12:21 +01:00