summaryrefslogtreecommitdiffstats
path: root/client/smartcard_channel.h
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-02-03 17:51:29 +0200
committerAlon Levy <alevy@redhat.com>2011-02-09 12:14:03 +0200
commit85ce53b6beaeec63023ce81cdf4a1c0c47f3b8bf (patch)
tree91fe30c62035f396e91cf79f579ca544ae2896dc /client/smartcard_channel.h
parent51da06793c33ff30b45154ccfc6e28d6d0d35db6 (diff)
downloadspice-85ce53b6beaeec63023ce81cdf4a1c0c47f3b8bf.tar.gz
spice-85ce53b6beaeec63023ce81cdf4a1c0c47f3b8bf.tar.xz
spice-85ce53b6beaeec63023ce81cdf4a1c0c47f3b8bf.zip
client/smartcard: libcacard dropped ReaderAddResponse
uses VSC_Error with code==VSC_SUCCESS instead. This means that the VSC_Error message is overloaded. Instead of the other option of adding a message id, since the connection is TCP so no messages may be dropped or reordered, by having each message followed by a response there is no ambiguity. Still this commit adds a queue for messages that we only have one of which outstanding at a time, i.e. send, wait for response, send the next, etc. This further simplifies the logic, while not adding much overhead since only when spicec starts up it has a situation where it needs to send two events (ReaderAdd and ATR for Card Insert).
Diffstat (limited to 'client/smartcard_channel.h')
-rw-r--r--client/smartcard_channel.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/client/smartcard_channel.h b/client/smartcard_channel.h
index 1d512a63..752713ba 100644
--- a/client/smartcard_channel.h
+++ b/client/smartcard_channel.h
@@ -86,6 +86,8 @@ public:
virtual void response(AbstractProcessLoop& events_loop);
};
+typedef std::pair<VEventType, Event*> SmartCardEvent;
+
class SmartCardChannel : public RedChannel {
public:
@@ -114,6 +116,13 @@ private:
typedef std::map<VReader*, ReaderData*> readers_by_vreader_t;
readers_by_vreader_t _readers_by_vreader;
readers_by_vreader_t _unallocated_readers_by_vreader;
+ VEventType _next_sync_vevent;
+ std::list<SmartCardEvent> _sync_events;
+
+ void push_sync_event(VEventType type, Event *event);
+ void send_next_sync_event();
+ void handle_reader_add_response(VSCMsgHeader *vheader, VSCMsgError *error);
+ void handle_error_message(VSCMsgHeader *vheader, VSCMsgError *error);
ReaderData* reader_data_from_vreader(VReader* vreader);
ReaderData* reader_data_from_reader_id(uint32_t reader_id);