Commit Graph

1657 Commits

Author SHA1 Message Date
Jonathon Jongsma
ffd2cda51e Move exit_on_disconnect to RedsState struct
Removing more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-03 15:05:48 +00:00
Jonathon Jongsma
9c512617cb Move agent_file_xfer to RedsState struct
Removing more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-03 15:03:21 +00:00
Jonathon Jongsma
fe4db36783 Move agent_copypaste to RedsState struct
Removing more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-03 15:01:39 +00:00
Frediano Ziglio
7a11b96095 compatibility patch for event loop
This patch use old code to implement timer events.
The new version use some function from GLib 2.34 however some systems
(like RHEL 6) have former GLib version (RHEL 6 has GLib 2.28 installed)

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-02-03 13:27:16 +00:00
Jonathon Jongsma
b85c8295d6 Remove use of global 'reds' var from spice_server_remove_interface()
Since this is public API, we can't easily change the signature of the
function to take a RedsState argument, so instead we apply a hack and
store the reds argument inside the device state struct when the
interface is added, and retrieve it for use later when it is removed.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-03 08:41:37 +00:00
Jonathon Jongsma
41adaa15ba Move ticketing_enabled to RedsState struct
Removing more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-03 08:33:42 +00:00
Jonathon Jongsma
da6618681c Move jpeg_state to RedsState struct
Also required adding reds_get_jpeg_state() for external access.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-02 15:58:47 +00:00
Jonathon Jongsma
f23c03e37b Move image_compression to RedsState struct
Removing more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-02 15:45:10 +00:00
Jonathon Jongsma
70a5cc9b09 Make default_security and channels_security non-global
Move them into the RedsState struct, adjust functions that use these
variables to take a RedsState arg.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-02 15:18:30 +00:00
Frediano Ziglio
8b14dc113c red-channel: send marshaller message fd
Send the fd associated to the last message sent.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-02 12:52:10 +00:00
Marc-Andre Lureau
15c908ef25 tests: make sure that the default rule builds all tests
The default rule being "all", it builds noinst_PROGRAMS but not
check_PROGRAMS. Let's build all the tests by default.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-02 11:36:10 +00:00
Victor Toso
0f4dd2730b reds: remove unused structs
RedsMigSpiceMessage and RedsMigCertPubKeyInfo

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01 15:42:34 +00:00
Frediano Ziglio
3cc00f1207 reds: constify renderers_info array
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-02-01 15:24:32 +00:00
Frediano Ziglio
e940ba1fe7 reds: remove default_renderer as field
Was used to just assure there was at least one renderer in the list.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-01 15:24:13 +00:00
Jonathon Jongsma
c5ec8760f8 Move spice_uuid, spice_uuid_is_set to RedsState struct
Removing more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01 15:20:54 +00:00
Jonathon Jongsma
a826bcad4e Move spice_name to RedsState struct
Remove more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01 15:20:54 +00:00
Jonathon Jongsma
fdcd8980ce Move sasl_enabled, sasl_appname to RedsState struct
Removing more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01 15:09:39 +00:00
Jonathon Jongsma
47c42d4f75 Move taTicket to RedsState struct
Removing more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01 15:09:39 +00:00
Jonathon Jongsma
1333e0ee8c Move spice_family to RedsState struct
Removing more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01 15:09:39 +00:00
Jonathon Jongsma
5aad27b25c Move spice_addr to RedsState struct
Removing more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01 14:46:24 +00:00
Jonathon Jongsma
905bfc8dbb Move migration_interface to RedsState struct
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01 14:46:24 +00:00
Jonathon Jongsma
deb6afc325 Move vdagent to RedsState struct
Also change API of reds_has_vdagent() to take RedsState arg.  Removes
another global variable.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01 14:05:36 +00:00
Jonathon Jongsma
6806bb6d46 Move spice_listen_socket_fd to RedsState struct
Removing more global variables

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01 13:57:56 +00:00
Jonathon Jongsma
d4d6747937 Move spice_secure_port to RedsState struct
removing more global variables

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-29 10:38:51 +00:00
Jonathon Jongsma
40f1e9429b Move spice_port to RedsState struct
Remove another global variable

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-29 10:36:52 +00:00
Jonathon Jongsma
8c8888e009 Change init_vd_agent_resources() to take RedsState arg
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-29 10:33:39 +00:00
Frediano Ziglio
3894b066c4 worker: unify flush_cursor_commands and flush_display_commands
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-01-29 00:20:10 +00:00
Frediano Ziglio
1020736efd worker: use glib main loop
Use the glib mainloop instead of writing our own. The glib loop is both
cleaner to use and is more extensible. It is also very mature and
reduces the maintenance burden on the spice server.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-01-28 16:16:50 +00:00
Jonathon Jongsma
b8066339bf Move default_renderer into RedsState
Not global.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-28 15:59:11 +00:00
Jonathon Jongsma
43a857f2ef main_channel_init() -> main_channel_new()
Rename to make function name more consistent

Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-28 15:34:53 +00:00
Jonathon Jongsma
3881abc081 inputs_init() -> inputs_channel_new()
Rename function to be more consistent

Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-28 15:34:53 +00:00
Jonathon Jongsma
ab55619492 Remove global inputs channel
Make the RedsState object own an InputsChannel object rather than
having a global inputs channel. This means changing a lot of
inputs-related API to take an InputsChannel* argument and moving the
keyboard, mouse, and tablet objects into the InputsChannel object.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-28 15:34:52 +00:00
Frediano Ziglio
a61ab509b2 worker: remove useless check
display_channel is never NULL.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
2016-01-28 08:15:50 +00:00
Frediano Ziglio
17684522e1 worker: remove useless test
red_channel_max_pipe_size returns 0 if no client (channel disconnected)
no need to check if cursor_channel/display_channel are NULL or
connected.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
2016-01-28 08:15:38 +00:00
Frediano Ziglio
871dbe5417 worker: do not leak cursor after disconnecting clients
Calling cursor_channel_disconnect does not free cursor_display
so this causes a leak.
Is the only code where this pointer is reset preventing any
further cursor channel connection. If a client is lazy reading
cursor data during the flush connection is closed and further clients
won't be able to use the cursor.
This also prevents future use of a NULL pointer.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
2016-01-28 08:15:04 +00:00
Frediano Ziglio
8191265f78 qxl: inline documentation for get_command and req_cmd_notification
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-01-27 11:06:56 -06:00
Frediano Ziglio
28e33ccdf0 worker: improved implementation of SpiceTimer
Use a custom GSource.
This to avoid having to allocate a timer all the time we add one.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-01-26 13:13:57 +00:00
Frediano Ziglio
1ad571f576 replay: do not wake up loop too much
Send wakeups only when a command is available.
This emulate better what a guest driver should do (append the command
to the ring and then signal).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-26 12:46:32 +00:00
Frediano Ziglio
a68d9a3100 worker: use core interface to create watch
This increase code reuse and make Glib integration more straight forward.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-01-26 12:46:04 +00:00
Frediano Ziglio
2a6adfcd1e worker: remove empty statement at line end
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-26 10:43:18 +00:00
Frediano Ziglio
4084b2b246 worker: use variable already set at beginning of loops
This is mainly question of style.
Instead of repeating same conversion use the variable we set at the
beginning of the function.
Note also that I used same name to make the two functions more
similar.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-26 10:31:18 +00:00
Frediano Ziglio
b2f5ef0f3c worker: remove max_pipe_size constant parameter
All checks for full channel pipes have to be consistents
so there is no point in passing as a parameter.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-26 10:21:01 +00:00
Marc-Andre Lureau
3d9ea0bb6b channel: do not call pipe_add with null items
If the creator was not able to produce the item, no need to call
pipe_add().

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat>
2016-01-22 13:22:33 +00:00
Marc-Andre Lureau
e5fa7f4740 channel: document pipes_create_batch() function
Rename callback to pipe_add, and document the arguments.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Frediano Ziglio <fziglio@redhat>
2016-01-22 13:22:33 +00:00
Jonathon Jongsma
77ae19c0c6 Replay: report error if we don't read the correct file header
The replay file should start with a header such as
  SPICE_REPLAY 1

Instead of soldiering on if we don't encounter this header, print a
warning and return NULL.  Also exit with a failure if spice_replay_new()
returns a NULL object in main.

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-22 11:03:30 +00:00
Jonathon Jongsma
e5d3b2bf73 Change some functions to take RedsState arg
In preparation for getting rid of the global 'reds' variable, we need to
pass the RedsState variable to all functions where it is needed. For now
the callers just pass in the global reds variable.

Functions changed:
- reds_mig_fill_wait_disconnect;
- reds_mig_cleanup_wait_disconnect;
- reds_mig_remove_wait_disconnect_client;
- reds_migrate_channels_seamless;
- reds_mig_finished;
- reds_mig_switch;
- reds_enable_mm_time;
- reds_disable_mm_time;
- attach_to_red_agent;
- reds_char_device_add_state;
- reds_char_device_remove_state;
- reds_on_char_device_state_destroy;
- spice_server_char_device_remove_interface;
- migrate_timeout.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-21 14:42:58 +00:00
Christophe Fergeau
6e407a81df event-loop: Remove template
Since SpiceCoreInterfaceInternal is a private data structure, we can
extend it as we see fit without breaking ABI. In particular, adding a
GMainContext member to it allows us to remove the need for
the event loop template which is currently included in the
basic_event_loop.c test file.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-21 14:19:24 +00:00
Christophe Fergeau
4b923347b7 test-loop: Improve basic_event_loop base_{timer, watch}_add
They call the functions provided by event_loop_core, but with a NULL
SpiceCoreInterfaceInternal parameter. It makes more sense to pass
event_loop_core rather than NULL.
This will allow to pass the GMainContext to be used through
SpiceCoreInterfaceInternal rather than through a template parameter.

Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-21 14:19:12 +00:00
Pavel Grunt
0bfad8a37f dcc: make dcc_compress_image_*() private
Reviewed-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-20 16:05:02 +00:00
Pavel Grunt
a310ac8860 dcc-send: Use dcc_compress_image to compress image
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-20 16:04:59 +00:00