summaryrefslogtreecommitdiff
path: root/server/reds.h
AgeCommit message (Collapse)AuthorFilesLines
2016-04-06reds: Move RedsState typedef to red-common.hChristophe Fergeau1-2/+0
This allows to stop using struct RedsState * rather than RedsState * in headers which cannot include reds.h. This also allows to remove the duplicate RedsState typedef in reds.h and reds-stream.h which is causing issues with older gcc versions.
2016-04-01Rename SpiceCharDeviceState to RedCharDeviceJonathon Jongsma1-1/+2
This is more consistent with internal type naming convention, and it paves the way for a new char device GObject heirarchy Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-24remove unused reds_set_mm_timeFrediano Ziglio1-1/+0
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2016-03-23Remove last usage of global 'reds' variableJonathon Jongsma1-1/+0
This should be the final piece of removing the global reds variable. We still need a global variable to clean up during the atexit() function, but we use a GList of servers (even though we technically don't support multiple servers in the same process yet). Acked-by: Fabiano Fidêncio <fidencio@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-04use QXLState instead of RedDispatcherFrediano Ziglio1-7/+4
Considering that: - QXLState is the state of QXLInstance implementation; - RedDispatcher is the implementation of QXL; - qif (QXLInterface*) field can be computed really easy from QXLInstance; - most of its state is private. Make all structure private and use QXLState instead of RedDispatcher. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-03-03Introduce reds_core_timer_*Christophe Fergeau1-0/+11
2016-03-03Introduce reds_core_watch_*Christophe Fergeau1-0/+10
These methods wrap the RedsCoreInterface::watch_add, RedsCoreInterface::watch_remove and RedsCoreInterface::watch_update_mask vfuncs. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-16Remove global main_dispatcher variableJonathon Jongsma1-0/+2
Requires changing a bunch of internal API to take MainDispatcher arguments, etc. The main dispatcher object is now owned by RedsState, since that is the object that previously created (initialized) it. Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16Remove global 'dispatchers', 'num_active_workers' variablesFrediano Ziglio1-1/+4
Since these are server-level variables, move them into RedsState. However, num_active_workers was removed because: - each dispatcher always has 1 active worker, so we can determine the number of active workers by counting the dispatchers - it was never actually set correctly. Even if there was more than one worker, this variable was always only set to either 0 or 1. This change required moving a bunch of helper code into RedsState as well, an providing some RedDispatcher interfaces to access dispatcher information from RedsState. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16move calc_compression_level to redsFrediano Ziglio1-0/+1
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-15Add RedsState arg to all stat functionsJonathon Jongsma1-3/+0
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11Store 'renderers' as GArray in RedsStateFrediano Ziglio1-3/+2
Acked-by: Jonathon Jongsma <jjongsma@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11Add RedsState arg to red_on_main_agent_tokens()Jonathon Jongsma1-1/+1
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11Move 'core' into RedsState structJonathon Jongsma1-2/+1
Also add reds_get_core_interface() accessor for external use. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-09Handle GL_SCANOUT messagesMarc-André Lureau1-0/+1
Go through dispatcher and marshall scanout message. Since the marshaller and the QXL state are manipulated from different threads, add a mutex to protect the current scanout. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2016-02-09Add new spice-gl stubs APIMarc-André Lureau1-0/+2
- spice_qxl_gl_scanout() to take the current scanout - spice_qxl_gl_draw_async() to draw the scanout, is like other Spice async functions, it takes a cookie and will return in the QXLInterface.async_complete() Two new fields are also added to QXLState, in order to save the current scanout, and the pending async. A scanout can't be updated if there are pending draw atm. Discarding outdated draws is left as a future improvement to allow updating the scanout without waiting for draw async to be done. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> [make QXL function names more coherent - Frediano Ziglio] Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-09Add RedsState arg to reds_handle_channel_event()Jonathon Jongsma1-1/+1
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-04Move agent_mouse to RedsState structJonathon Jongsma1-1/+1
Required adding a RedsState arg to reds_get_agent_mouse() Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-04Move streaming_video to RedsState structJonathon Jongsma1-1/+1
Also requires adding reds_get_streaming_video() accessor so that other files can check this value. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-03Move zlib_glz_state to RedsState structJonathon Jongsma1-1/+1
Also required adding reds_get_zlib_glz_state() for external access. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-02Move jpeg_state to RedsState structJonathon Jongsma1-1/+1
Also required adding reds_get_jpeg_state() for external access. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-02Move image_compression to RedsState structJonathon Jongsma1-1/+0
Removing more global variables Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-01Move vdagent to RedsState structJonathon Jongsma1-1/+1
Also change API of reds_has_vdagent() to take RedsState arg. Removes another global variable. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-21Change some functions to take RedsState argJonathon Jongsma1-3/+3
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-20Change some functions to take RedsState argJonathon Jongsma1-4/+4
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_link_mig_target_channels; - reds_on_migrate_dst_set_seamless; - reds_on_client_seamless_migrate_complete; - reds_on_client_semi_seamless_migrate_complete; - reds_handle_other_links; - reds_handle_link; - reds_send_mm_time; - reds_set_client_mm_time_latency; - reds_init_net; - do_spice_init; - reds_init_ssl; - on_activating_ticketing; - reds_mig_release to take RedsState arg - reds_mig_started. Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-20Change some functions to take RedsState argJonathon Jongsma1-6/+7
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_on_main_migrate_connected; - reds_on_main_mouse_mode_request; - reds_on_main_channel_migrate; - reds_marshall_migrate_data; - reds_agent_state_restore; - reds_handle_migrate_data; - reds_send_link_ack; - reds_mig_target_client_add; - reds_mig_target_client_find; - reds_mig_target_client_free; - reds_mig_target_client_disconnect_all; - reds_find_client; - reds_get_client; - reds_handle_main_link; - reds_set_client_mouse_allowed. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-19reds_num_of_clients() -> reds_get_n_clients()Jonathon Jongsma1-1/+0
More consistent with glib naming conventions. Also make the function static since it's not used outside of this source file. Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-19reds_num_of_channels() -> reds_get_n_channels()Jonathon Jongsma1-1/+1
More consistent with glib naming conventions. Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-19Change some functions to take RedsState argJonathon Jongsma1-8/+8
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: - vdi_port_read_buf_process; - vdi_port_read_buf_get; - vdi_port_read_buf_unref; - reds_handle_agent_mouse_event; - reds_num_of_channels; - reds_num_of_clients; - reds_fill_channels; - reds_on_main_agent_start; - reds_get_agent_data_buffer; - reds_release_agent_data_buffer; - reds_client_monitors_config_cleanup; - red_on_main_agent_data. Acked-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-18Change some functions to take RedsState argJonathon Jongsma1-4/+4
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_register_channel; - reds_unregister_channel; - reds_get_mouse_mode; - reds_set_mouse_mode; - reds_update_mouse_mode; - reds_agent_remove; - reds_find_channel; - reds_mig_cleanup; - reds_reset_vdp; - reds_main_channel_connected; - reds_client_disconnect; - reds_disconnect; - reds_mig_disconnect. Acked-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-01-15Make global 'reds' externJonathon Jongsma1-0/+3
This allows it to be accessed from other files. This is a temporary step toward getting rid of the global-ness of this variable, and it allows us to update the function signature bit-by-bit. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-11channel: add a new internal SpiceCoreInterfaceFrediano Ziglio1-1/+1
Define an internal structure that matches 100% the ABI of the public one. The structure will be changed by following patches. See comments in "channel: add interface parameters to SpiceCoreInterfaceInternal" patch. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2015-12-03server: rename filesFrediano Ziglio1-3/+3
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2015-11-21server: remove OpenGLMarc-André Lureau1-2/+0
This is really not supported, requires X11, so better to remove it for now. Some day it might be revived, using DRM, .. Note for later, this could be removed too (not used by client): - spice-common/common/ogl_ctx Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2015-10-26worker: remove need for WorkerInitDataMarc-André Lureau1-0/+16
Move code around to declare and place it where it fits better. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2015-08-11Move RedsMigSpice to main-channel.hJonathon Jongsma1-7/+0
This is the place that needs the complete type definition. If it is defined in reds.h, it can create circular references.
2014-11-27Rename mm_timer/mm_timeMarc-André Lureau1-2/+2
As suggested by Christophe on the mailing list.
2014-09-08clean-up: remove unused functionMarc-André Lureau1-1/+0
2014-01-20Add reds_stream.[ch]Christophe Fergeau1-64/+0
Gather common RedsStream code there rather than having it in reds.c
2014-01-20Move SPICE_GNUC_VISIBLE to red_common.hChristophe Fergeau1-2/+0
2013-07-29decouple disconnection of the main channel from client destructionYonit Halperin1-0/+2
Fixes rhbz#918169 Some channels make direct calls to reds/main_channel routines. If these routines try to read/write to the socket, and they get socket error, main_channel_client_on_disconnect is called, and triggers red_client_destroy. In order to prevent accessing expired references to RedClient, RedChannelClient, or other objects (inside the original call, after red_client_destroy has been called) I made the call to red_client_destroy asynchronous with respect to main_channel_client_on_disconnect. I added MAIN_DISPATCHER_CLIENT_DISCONNECT to main_dispatcher. main_channel_client_on_disconnect pushes this msg to the dispatcher, instead of calling directly to reds_client_disconnect. The patch uses RedClient ref-count in order to handle a case where reds_client_disconnect is called directly (e.g., when a new client connects while another one is connected), while there is already CLIENT_DISCONNECT msg pending in the main_dispatcher. Examples: (1) snd_worker.c snd_disconnect_channel() channel->cleanup() //snd_playback_cleanup reds_enable_mm_timer() . . main_channel_push_multi_media_time()...socket_error . . red_client_destory() . . snd_disconnect_channel() channel->cleanup() celt051_encoder_destroy() celt051_encoder_destory() // double release Note that this bug could have been solved by changing the order of calls: e.g., channel->stream = NULL before calling cleanup, and some other changes + reference counting. However, I found other places in the code with similar problems, and I looked for a general solution, at least till we redesign red_channel to handle reference counting more consistently. (2) inputs_channel.c inputs_connect() main_channel_client_push_notify()...socket_error . . red_client_destory() . . red_channel_client_create() // refers to client which is already destroyed (3) reds.c reds_handle_main_link() main_channel_push_init() ...socket error . . red_client_destory() . . main_channel_client_start_net_test(mcc) // refers to mcc which is already destroyed This can explain the assert in rhbz#964136, comment #1 (but not the hang that occurred before).
2013-05-08reds: move handle_channel_event logic from main_dispatcher to redsYonit Halperin1-0/+4
main_dispactcher role is to pass events to the main thread. The logic that handles the event better not be inside main_dispatcher.
2013-04-22reds: support mm_time latency adjustmentsYonit Halperin1-0/+2
When there is no audio playback, we set the mm_time in the client to be older than the one in the server by at least the requested latency (the delta is actually bigger, due to the network latency). When there is an audio playback, we adjust the mm_time in the client by adjusting the playback buffer using SPICE_MSG_PLAYBACK_LATENCY.
2012-11-04Revert "server: add websockets support via libwebsockets"Alon Levy1-17/+0
This reverts commit 63bb37276e028ab1b1c156c9e7907bf22b6d5952.
2012-10-25server: add websockets support via libwebsocketsAlon Levy1-0/+17
New API: spice_server_set_ws_ports This adds an optional dependency on libwebsockets. You need to get my patched 0.0.3 version here: git://people.freedesktop.org/~alon/libwebsockets There is no qemu patches yet, to test change in reds.c the default value of spice_ws_port to 5959 (for the default of spice-html5). For testing there is an online client at http://spice-space.org/spice-html5/spice.html Known issues: 1. The tester (server/tests/test_display_no_ssl) gets into dropping all data after a few seconds, I think it's an issue with the implemented watches, but haven't figured it out. 2. libwebsocket's read interface is inverted to what our code expects, i.e. there is no libwebsocket_read, so there is an additional copy involved (see RedsWebSocket). This can be fixed. 3. Listening on a separate port. Since the headers are different, we could listen on the same port (first three bytes RED/GET). I don't know if we want to? Todos: 1. SSL not implemented yet. Needs some thought as to how. 2. Serve spice-html5 when accessed as a http server. Nice to have.
2012-08-27main: restore state from migration dataYonit Halperin1-1/+3
Also removed old migration leftovers.
2012-08-27main: send migration dataYonit Halperin1-1/+1
Also removed some unused definitions from reds that used to belong to old agent and migration code.
2012-08-27main: send MSG_MIGRATE upon vm migration completionYonit Halperin1-0/+1
Before sending the above msg, if there is a pending partial msg that has been read from the agent, we send it to the client. The alternative was to keep the msg as part of the migration data, and then to send it to the destination server via the client and to wait there for the msg chunk completion, before sending it to the client. Of course, the latter is less efficient.
2012-08-27seamless migration: migration completion on the destination sideYonit Halperin1-1/+2
Tracking the channels that wait for migration data. If there is a new migration process pending, when all the channels have restored their state, we begin the new migration.
2012-08-27seamless migration: pre migration phase on the destination sideYonit Halperin1-0/+3
- handle SPICE_MSGC_MAIN_MIGRATE_DST_DO_SEAMLESS - reply with SPICE_MSG_MAIN_MIGRATE_DST_SEAMLESS_ACK/NACK - prepare the channels for migration according to the migration type (semi/seamless) see spice-protocol for more details: commit 3838ad140a046c4ddf42fef58c9727ecfdc09f9f