1
2
3
4
5
6
7
8
9
10
|
/*
* Google's PCSC library requires us to write our module in C++ (thanks, Google)
* This library wraps the actual library, written in C.
*/
#include <thread>
#include <ppapi/cpp/instance.h>
#include <ppapi/cpp/module.h>
#include <ppapi/cpp/core.h>
#include <ppapi/cpp/var.h>
|
|
>
>
|
|
1
2
3
4
5
6
7
8
9
10
11
12
|
/*
* Google's PCSC library requires us to write our module in C++ to initialize
* it. This component handles the initialization of our module and handles
* incoming messages, passing them either to our library (cackey-chrome) or
* to the PCSC-NaCl library from Google as appropriate.
*/
#include <thread>
#include <ppapi/cpp/instance.h>
#include <ppapi/cpp/module.h>
#include <ppapi/cpp/core.h>
#include <ppapi/cpp/var.h>
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
/*
* Verify that this message is destined for us
*/
if (!message->HasKey("target")) {
delete message;
pcscNaClHandleMessage(messagePlain);
return;
}
target = message->Get("target");
if (target.AsString() != "cackey") {
delete message;
pcscNaClHandleMessage(messagePlain);
return;
}
/*
* Determine what we are being asked to do
*/
if (!message->HasKey("command")) {
delete message;
pcscNaClHandleMessage(messagePlain);
return;
}
/*
* Process the request in another thread
|
>
>
>
|
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
/*
* Verify that this message is destined for us
*/
if (!message->HasKey("target")) {
delete message;
/* We don't handle this message, see if PCSC-NaCl does */
pcscNaClHandleMessage(messagePlain);
return;
}
target = message->Get("target");
if (target.AsString() != "cackey") {
delete message;
/* We don't handle this message, see if PCSC-NaCl does */
pcscNaClHandleMessage(messagePlain);
return;
}
/*
* Determine what we are being asked to do
*/
if (!message->HasKey("command")) {
delete message;
/* We don't handle this message, see if PCSC-NaCl does */
pcscNaClHandleMessage(messagePlain);
return;
}
/*
* Process the request in another thread
|