summaryrefslogtreecommitdiff
path: root/server/reds.c
AgeCommit message (Collapse)AuthorFilesLines
2016-04-15char-device: Remove RedCharDeviceClass::{un, }ref_msg_to_clientChristophe Fergeau1-14/+0
Now that client messages are always RedPipeItem, we don't need virtual functions to know how to ref/unref them.
2016-04-15char-device: Replace RedCharDeviceMsgToClient with PipeItemChristophe Fergeau1-8/+8
Now that all derived classes use a type deriving from PipeItem for their RedCharDeviceMsgToClient, we can make this explicit in the RedCharDeviceClass vfuncs, and remove the RedCharDeviceMsgToClient typedef.
2016-04-15reds: Derive VDIPortReadBuf from PipeItemChristophe Fergeau1-36/+38
Since PipeItem is already refcounted, this allows to remove various layers of ref/unref helpers from reds.c, and use the generic pipe_item_{ref, unref} instead.
2016-04-11char-device: Fix el6 compilationChristophe Fergeau1-1/+0
One more duplicate typedef, once in reds.c and another time in reds-private.h RedsState::agent_dev is defined in reds-private.h but only used in reds.c, so longer term this could all be moved back to reds.c
2016-04-07Move RedCharDeviceCallbacks into RedCharDeviceClassChristophe Fergeau1-20/+15
This structure holding virtual function pointers was kept until now as a RedCharDevice member in order to make the GObject conversion easier. Now that all RedCharDevice children are converted to GObject, it can be moved into RedCharDeviceClass.
2016-04-06reds: Make VDIPortState a GObjectChristophe Fergeau1-89/+159
This inherits from RedCharDevice. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-06Rename VDIPortState to RedCharDeviceVDIPortJonathon Jongsma1-213/+213
Consistent with internal naming conventions, and prepares for conversion to GObject
2016-04-05gobject: Add g_type_init() for older glibsChristophe Fergeau1-0/+3
Older glib versions require g_type_init() to be called before using GObject.
2016-04-02reds: Prepare to make VDIPortState a GObjectChristophe Fergeau1-195/+200
This inherits from RedCharDevice. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-02reds: Make VDIPortState private to reds.cChristophe Fergeau1-58/+111
VDIPortState and VDIReadBuf don't really need to be defined in a header file as they are only used in reds.c Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-04-01Rename some missing names related to RedCharDeviceFrediano Ziglio1-1/+1
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-04-01Rename SpiceCharDeviceCallbacks to RedCharDeviceCallbacksFrediano Ziglio1-1/+1
The structure is an internal one so should not have the Spice prefix but use the Red one. Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-04-01Rename RedCharDevice functionsJonathon Jongsma1-58/+58
make the function names match the type names. So spice_char_device_state_* becomes red_char_device_* and spice_char_device_* also becomes red_char_device_*. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-01Rename SpiceCharDeviceState to RedCharDeviceJonathon Jongsma1-17/+17
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-04-01Rename SpiceCharDeviceWriteBuffer to RedCharDeviceWriteBufferJonathon Jongsma1-2/+2
Internal types should use 'Red' namespace for consistency Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-04-01Rename SpiceCharDeviceMsgToClient to RedCharDeviceMsgToClientJonathon Jongsma1-6/+6
Internal types should use Red namespace for consistency Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-24server: More clearly identify channels that support multiple clientsFrancois Gouget1-10/+9
Rename the function to channel_supports_multiple_clients() as channel_is_secondary() is unclear and was coded to return the opposite of what was originally intended. Also there are few channel types and whether they support multiple clients is totally static so we might as well delegate the check to the compiler. Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
2016-03-24remove unused reds_set_mm_timeFrediano Ziglio1-10/+0
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
2016-03-23use constructor/destructor macrosFrediano Ziglio1-6/+1
Initialize global images at load time: - make sure these stuff are initialized without using runtime resources; - make sure stuff are initialize really earlier. Do not use atexit function but a destructor. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-23Remove last usage of global 'reds' variableJonathon Jongsma1-108/+84
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-21Remove dependency of vdi_port_read_buf_process on RedsStateChristophe Fergeau1-7/+17
This makes it easier to move the VDIPort API to a different file, and make it as self-contained as possible. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-21agent: Sync AgentMsgFilter state upon agent connectionChristophe Fergeau1-2/+8
AgentMsgFilter needs to know whether monitors config messages need to be filtered or not. This used to be done from within agent_msg_filter_config() using the global RedsState, but this got more tricky as it was removed. A first attempt a1e62fa5ae9 caused crashes on qemu startup with "qemu-system-x86_64 -spice port=5900" (without -vga qxl). A second attempt added a RedsState* argument to agent_msg_filter_config() which in my opinion is not really nice from a layering point of view. This new attempt makes sure AgentMsgFilter state is correct when the filter is set to stop discarding all data, which allows to remove direct use of RedsState from within AgentMsgFilter. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-21Revert "fix regression due to callback called earlier"Christophe Fergeau1-6/+12
Passing Reds into agent-msg-filter.[ch] isn't the right thing to do from a layering point of view. This reverts commit a1e62fa5ae983b7b69cb437b2635ce84b2471383. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-17Use QXLInstance instead of QXLState in red_qxl_*Christophe Fergeau1-42/+45
This seems to make more sense this way, QXLInstance is the 'main' object with QXLState being its private data. External users then use QXLInstance rather than passing a pointer to the private data to red-qxl.h methods. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-11Remove spice_server_set_keepalive_timeoutChristophe Fergeau1-7/+0
This public API is no longer needed as the keepalive interval does not need to be configurable. This API was present in the 0.13.0 release, but was never added to a stable release, in my opinion it's still acceptable to remove it without changing soname.
2016-03-11Always enable TCP keepaliveChristophe Fergeau1-14/+26
Always enabled, hardcoded interval as per https://bugzilla.redhat.com/show_bug.cgi?id=1298590
2016-03-09Replace RedsPrivate::mig_wait_disconnect_clients with a GListChristophe Fergeau1-28/+7
The code was introducing an intermediate RedsMigWaitDisconnectClient type to hold linked list elements, resulting in a memory handling behaviour very similar to a GList. Using GList directly makes the code shorter and more readable. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-09Replace RedsPrivate::char_devs_state with a GListChristophe Fergeau1-31/+10
The code was introducing an intermediate SpiceCharDevStateItem type to hold linked list elements, resulting in a memory handling behaviour very similar to a GList. Using GList directly makes the code shorter and more readable. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-09Introduce spice_char_device_get_interface()Christophe Fergeau1-3/+3
Hides awkward casting/dereferencing to go from a SpiceCharDeviceInstance to a SpiceCharDeviceInterface Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-05Store reference to RedsState in QXLStateJonathon Jongsma1-1/+1
Remove use of global 'reds' variable from QXLState functions. Instead store the owning RedsState variable inside the QXLState struct and use that when necessary. Acked-by: Fabiano Fidêncio <fidencio@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-04use QXLState instead of RedDispatcherFrediano Ziglio1-42/+38
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-04rename red-dispatcher.* files to red-qxl.*Frediano Ziglio1-1/+1
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-04rename red_dispatcher_ functions to red_qxl_Frediano Ziglio1-16/+16
RedDispatcher is basically implementing QXLInstance. After some internal discussion we decided to use QXLState structure and red_qxl_ as function prefix. This is the first of 3 patches that rename functions, structure and files. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-03Introduce reds_core_timer_*Christophe Fergeau1-0/+43
2016-03-03Introduce reds_core_watch_*Christophe Fergeau1-15/+51
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-23use G_N_ELEMENTS instead of manually compute array sizeFrediano Ziglio1-1/+1
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-23constify some global variablesFrediano Ziglio1-2/+2
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-19fix regression due to callback called earlierFrediano Ziglio1-12/+6
Patch 1f210080609f2c00b4d1859eb0b363a38838e7d3 ("Remove use of global 'reds' from AgentMsgFilter") introduced a regression. This because QXLInterface->client_monitors_config was called before returning from spice_add_interface. Some client of spice-server expect the spice_add_interface already returned and some state change was done before client_monitors_config was called. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-17reds: remove unneeded variableFrediano Ziglio1-3/+1
Remove version_string variable. Was never changed and used in a single place. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-16Remove redundant argument to vdi_port_read_buf_processChristophe Fergeau1-4/+4
The 'port' argument can be determined from VDIPortState, so no need to pass both (through RedsState) to vdi_port_read_buf_process(). Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-16Remove use of global 'reds' from AgentMsgFilterJonathon Jongsma1-4/+10
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16Remove use of global 'reds' from sound.cJonathon Jongsma1-2/+2
Pass RedsState variable to snd_attach_(playback|record) and get a reference to this variable when needed by various functions. Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16Remove global main_dispatcher variableJonathon Jongsma1-1/+6
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-16Add RedsState reference to RedsStreamJonathon Jongsma1-1/+1
Allows us to remove use of global 'reds' variable from reds-stream.c. Requires changing the RedsStream constructor to accept a RedsState arg. Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-16Remove global 'dispatchers', 'num_active_workers' variablesFrediano Ziglio1-4/+85
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 red_dispatcher_on_vm_stop and red_dispatcher_on_vm_start to RedsStateFrediano Ziglio1-4/+31
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-16use list in RedsState for ic_change and sv_changeFrediano Ziglio1-2/+28
Instead of using list in RedDispatcher (which is going to be removed) use the one in 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-16keep dispatcher list in RedsStateFrediano Ziglio1-4/+11
This duplicate the other list which will be removed 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/+12
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-16remove num_active_workersFrediano Ziglio1-2/+1
This global variable was mainly 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>