summaryrefslogtreecommitdiff
path: root/server/smartcard.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-7/+7
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-15smartcard: Use base PipeItem for MsgItem refcountingChristophe Fergeau1-23/+12
This allows to reuse pipe_item_{ref, unref} rather than reimplementing them in smartcard.c
2016-04-07Move RedCharDeviceCallbacks into RedCharDeviceClassChristophe Fergeau1-10/+10
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-06smartcard: Turn RedCharDeviceSmartcard into a GObjectChristophe Fergeau1-57/+71
This inherits from RedCharDevice. Once all char device states are converted, we can turn the associated vfuncs into RedCharDeviceClass vfuncs. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
2016-04-06Rename SmartCardDeviceState to RedCharDeviceSmartcardJonathon Jongsma1-130/+130
More consistent with naming conventions, and prepares for converting this type to a GObject which inherits from RedCharDevice.
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-30/+30
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-20/+20
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-6/+6
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-30smartcard: Prepare to turn SmartcardState into a GObjectChristophe Fergeau1-69/+73
Move all internal data into a private struct so that it won't be exposed when we move SmartCardDeviceState into the header. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-24make some functions staticFrediano Ziglio1-2/+2
No need to have callback registered internally no static 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-6/+6
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-17Remove red_channel_set_data()Christophe Fergeau1-1/+1
It's always called at the same time as red_channel_register_client_cbs() and the data is used by the callbacks, so we can pass the data as an argument to red_channel_register_client_cbs(). Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-03-10smartcard: Move private constant to C fileChristophe Fergeau1-0/+3
APDUBufSize is only used within smartcard.c, no need to expose it in smartcard.h Acked-by: Pavel Grunt <pgrunt@redhat.com> Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-03-10Rename red_channel_pipe_item_init to pipe_item_initChristophe Fergeau1-4/+2
The RedChannel argument is not used by pipe_item_init. Removing it will make code simpler in places where we don't have a RedChannel directly available. This is acting on a PipeItem object so correct name is pipe_item_init. Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-09Introduce spice_char_device_get_interface()Christophe Fergeau1-1/+1
Hides awkward casting/dereferencing to go from a SpiceCharDeviceInstance to a SpiceCharDeviceInterface Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-12Store a reference to RedsState in Channel base classJonathon Jongsma1-0/+1
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-12Add RedsState arg to smartcard_device_connect()Jonathon Jongsma1-4/+4
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11char-device: use local 'reds' variableJonathon Jongsma1-0/+1
Store a reference to the server in the SpiceCharDeviceState struct and use that rather than the global 'reds' variable Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-02-11Move 'core' into RedsState structJonathon Jongsma1-1/+2
Also add reds_get_core_interface() accessor for external use. Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-01-18Change some functions to take RedsState argJonathon Jongsma1-1/+1
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>
2015-12-10channel: rename red_channel_(client_)waits_* functionsFrediano Ziglio1-1/+1
Make clear that these funcion are just checking a condition. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@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-12-02smartcard: include libcacard.h if possibleMarc-André Lureau1-0/+6
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2013-04-22red_channel: monitor connection latency using MSG_PINGYonit Halperin1-0/+1
2012-11-26smartcard.c: avoid marshalling migration data with reference to a memory ↵Yonit Halperin1-1/+1
that might be released before send has completed The current solution just copy the buffer. Currently data that is read from the guest is always copied before sending it to the client. When we will have ref count for these buffers, we can also use it for marshalling the migration data.
2012-08-27red_channel: remove unused migrate flag from RedChannelYonit Halperin1-1/+0
The relevant flags reside in RedChannelClient and RedClient
2012-08-27char_device: don't connect a migrated client if the state of the device ↵Yonit Halperin1-7/+15
might have changed since it was created If reading/writing from the device have occured before migration data has arrived, the migration data might no longer be relvant, and we disconnect the client.
2012-08-27smartcard: restore state after migration from migration dataYonit Halperin1-7/+75
2012-08-27smartcard migration: send migration dataYonit Halperin1-5/+51
2012-08-27smartcard: send MSG_MIGRATE upon vm migration completionYonit Halperin1-5/+0
The above is the default behaviour for red_channel_client, if client_cbs.migrate is not registered as part of red_channel_register_client_cbs
2012-08-27smartcard: fix PIPE_ITEMs enum indexingYonit Halperin1-1/+1
The enum should start from PIPE_ITEM_TYPE_CHANNEL_BASE, otherwise, PIPE_ITEM_TYPE_ERROR is handled like PIPE_ITEM_TYPE_SET_ACK.
2012-08-27smartcard: change the timing of attaching a client to SpiceCharDeviceStateYonit Halperin1-45/+75
Attach/detach a client to a SpiceCharDeviceState upon its connection/disconnection, instead of upon reader_add/remove messages. When the client is removed from a SpiceCharDeviceState, all the messages from this client are removed from the device write queue. This shouldn't happen when we only receive reader_remove and the client is still connected.
2012-08-27char device migration: don't read or write from/to the device while waiting ↵Yonit Halperin1-1/+2
for migraion data
2012-08-27red_channel: handle sending SPICE_MSG_MIGRATEYonit Halperin1-1/+3
The relevant code is common to all channels. The patch also contains a fix to the return value for handle_migrate_data callback: s/uint64_t/int
2012-07-04smartcard: Remove redefinition of typedef 'SmartCardDeviceState'Yonit Halperin1-2/+2
2012-07-03smartcard: use SpiceCharDeviceState for writing to the guest deviceYonit Halperin1-22/+93
With SpiceCharDeviceState, the smartcard code now supports partial writes, and storing data that is received from the client after the device is stopped, instead of attempting to write it to the guest.
2012-07-03smartcard: creating SmartCardChannelClient typeYonit Halperin1-50/+56
The lifetime of the channel is not necessarily correlated to the life time of the device. In the next patch, we need to keep a reference to SpiceCharDeviceWriteBuffer, which might be in use even if the SpiceCharDeviceState is destroyed, but the channel is still connected. The next patch keeps this reference inside SmartCardChannelClient. This patch also removes the routine smartcard_readers_detach_all(rcc), which is unnecessary since we don't support multiple readers; even when we do support them, each channel client should be associated with only one reader (i.e., we will have different channels for different readers).
2012-07-03smartcard: use SpiceCharDeviceState for managing reading from the deviceYonit Halperin1-41/+127
This patch and the following one do not introduce tokening to the smartcard channel. But this can be done easily later, by setting the appropriate variables in SpiceCharDeviceState (after adding the appropriate protocol messages, and implementing this in the client side).
2012-07-03smartcard: fix an error messageYonit Halperin1-1/+1
2012-07-03smartcard: fix calc of remaining data size when reading more than one msg ↵Yonit Halperin1-1/+1
from the device
2012-05-21server: handle red_channel_client_create returning NULLYonit Halperin1-0/+3
2012-04-25VSCMsgHeader.reader_id is unsigned, so don't check for >= 0Daniel P. Berrange1-2/+1
* server/smartcard.c: Fix assertion to not check for >= 0 on unsigned variable Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-04-25Convert cases of () to (void)Daniel P. Berrange1-4/+4
* server/reds.c, server/smartcard.c: s/()/(void) Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-03-25Use the spice-common logging functionsMarc-André Lureau1-12/+12
It will abort by default for critical level messages. That behaviour can be tuned at runtime.
2012-03-25Use the spice-common submoduleMarc-André Lureau1-5/+5
This patch will replace the common/ directory with the spice-common project. It is for now a simple project subdirectory shared with spice-gtk, but the goal is to make it a proper library later on. With this change, the spice-server build is broken. The following commits fix the build, and have been seperated to ease the review. v2 - moves all the generated marshallers to spice-common library - don't attempt to fix windows VS build, which should somehow be splitted with spice-common (or built from tarball only to avoid generation tools/libs deps) v3 - uses libspice-common-client - fix a mutex.h inclusion reported by Alon
2012-03-10Ensure all members of ChannelCbs and ClientCbs are either assigned or NULLHans de Goede1-5/+2
While git-bisecting another issue I ended up hitting and not recognizing the bug fixed by commit 7a079b452b026d6ce38f95dcc397fa64b059fffb. While fixing this (again) I noticed that (even after the fix) not all users of ChannelCbs first zero it. So this patch ensures that all users of ChannelCbs first zero it, and does the same for ClientCbs while at it. Since before this patch there were multiple zero-ing styles, some using memset and other using a zero initializer this patch also unifies all the zero-ing to use a NULL initializer for the first element. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-01-13Rewrite code to avoid triggering warning about casting param to free()Daniel P. Berrange1-1/+2
Since free() takes a void* parameters do not need to be cast. The existing code here is actally fine, but it trips up the syntax-check rule, so tweak it to an equivalent construct which passes the syntax check