browser-protocol 0.1.2

Generated Rust types and commands for the Chrome DevTools Protocol (browser-protocol)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;

/// Indicates the PC/SC error code.
/// 
/// This maps to:
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__ErrorCodes.html
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/secauthn/authentication-return-values

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum ResultCode {
    #[default]
    Success,
    RemovedCard,
    ResetCard,
    UnpoweredCard,
    UnresponsiveCard,
    UnsupportedCard,
    ReaderUnavailable,
    SharingViolation,
    NotTransacted,
    NoSmartcard,
    ProtoMismatch,
    SystemCancelled,
    NotReady,
    Cancelled,
    InsufficientBuffer,
    InvalidHandle,
    InvalidParameter,
    InvalidValue,
    NoMemory,
    Timeout,
    UnknownReader,
    UnsupportedFeature,
    NoReadersAvailable,
    ServiceStopped,
    NoService,
    CommError,
    InternalError,
    ServerTooBusy,
    Unexpected,
    Shutdown,
    UnknownCard,
    Unknown,
}

/// Maps to the |SCARD_SHARE_*| values.

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum ShareMode {
    #[default]
    Shared,
    Exclusive,
    Direct,
}

/// Indicates what the reader should do with the card.

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum Disposition {
    #[default]
    LeaveCard,
    ResetCard,
    UnpowerCard,
    EjectCard,
}

/// Maps to |SCARD_*| connection state values.

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum ConnectionState {
    #[default]
    Absent,
    Present,
    Swallowed,
    Powered,
    Negotiable,
    Specific,
}

/// Maps to the |SCARD_STATE_*| flags.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReaderStateFlags {

    #[serde(skip_serializing_if = "Option::is_none")]
    pub unaware: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub ignore: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub changed: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub unknown: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub unavailable: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub empty: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub present: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub exclusive: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub inuse: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub mute: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub unpowered: Option<bool>,
}

/// Maps to the |SCARD_PROTOCOL_*| flags.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ProtocolSet {

    #[serde(skip_serializing_if = "Option::is_none")]
    pub t0: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub t1: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub raw: Option<bool>,
}

/// Maps to the |SCARD_PROTOCOL_*| values.

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum Protocol {
    #[default]
    T0,
    T1,
    Raw,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReaderStateIn {

    pub reader: String,

    pub currentState: ReaderStateFlags,

    pub currentInsertionCount: u64,
}


#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReaderStateOut {

    pub reader: String,

    pub eventState: ReaderStateFlags,

    pub eventCount: u64,

    pub atr: String,
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct EnableParams {}

impl EnableParams { pub const METHOD: &'static str = "SmartCardEmulation.enable"; }

impl crate::CdpCommand for EnableParams {
    const METHOD: &'static str = "SmartCardEmulation.enable";
    type Response = crate::EmptyReturns;
}

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DisableParams {}

impl DisableParams { pub const METHOD: &'static str = "SmartCardEmulation.disable"; }

impl crate::CdpCommand for DisableParams {
    const METHOD: &'static str = "SmartCardEmulation.disable";
    type Response = crate::EmptyReturns;
}

/// Reports the successful result of a |SCardEstablishContext| call.
/// 
/// This maps to:
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardestablishcontext

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReportEstablishContextResultParams {

    pub requestId: String,

    pub contextId: u64,
}

impl ReportEstablishContextResultParams { pub const METHOD: &'static str = "SmartCardEmulation.reportEstablishContextResult"; }

impl crate::CdpCommand for ReportEstablishContextResultParams {
    const METHOD: &'static str = "SmartCardEmulation.reportEstablishContextResult";
    type Response = crate::EmptyReturns;
}

/// Reports the successful result of a |SCardReleaseContext| call.
/// 
/// This maps to:
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga6aabcba7744c5c9419fdd6404f73a934
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardreleasecontext

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReportReleaseContextResultParams {

    pub requestId: String,
}

impl ReportReleaseContextResultParams { pub const METHOD: &'static str = "SmartCardEmulation.reportReleaseContextResult"; }

impl crate::CdpCommand for ReportReleaseContextResultParams {
    const METHOD: &'static str = "SmartCardEmulation.reportReleaseContextResult";
    type Response = crate::EmptyReturns;
}

/// Reports the successful result of a |SCardListReaders| call.
/// 
/// This maps to:
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardlistreadersa

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReportListReadersResultParams {

    pub requestId: String,

    pub readers: Vec<String>,
}

impl ReportListReadersResultParams { pub const METHOD: &'static str = "SmartCardEmulation.reportListReadersResult"; }

impl crate::CdpCommand for ReportListReadersResultParams {
    const METHOD: &'static str = "SmartCardEmulation.reportListReadersResult";
    type Response = crate::EmptyReturns;
}

/// Reports the successful result of a |SCardGetStatusChange| call.
/// 
/// This maps to:
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetstatuschangea

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReportGetStatusChangeResultParams {

    pub requestId: String,

    pub readerStates: Vec<ReaderStateOut>,
}

impl ReportGetStatusChangeResultParams { pub const METHOD: &'static str = "SmartCardEmulation.reportGetStatusChangeResult"; }

impl crate::CdpCommand for ReportGetStatusChangeResultParams {
    const METHOD: &'static str = "SmartCardEmulation.reportGetStatusChangeResult";
    type Response = crate::EmptyReturns;
}

/// Reports the result of a |SCardBeginTransaction| call.
/// On success, this creates a new transaction object.
/// 
/// This maps to:
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardbegintransaction

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReportBeginTransactionResultParams {

    pub requestId: String,

    pub handle: i64,
}

impl ReportBeginTransactionResultParams { pub const METHOD: &'static str = "SmartCardEmulation.reportBeginTransactionResult"; }

impl crate::CdpCommand for ReportBeginTransactionResultParams {
    const METHOD: &'static str = "SmartCardEmulation.reportBeginTransactionResult";
    type Response = crate::EmptyReturns;
}

/// Reports the successful result of a call that returns only a result code.
/// Used for: |SCardCancel|, |SCardDisconnect|, |SCardSetAttrib|, |SCardEndTransaction|.
/// 
/// This maps to:
/// 1. SCardCancel
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel
/// 
/// 2. SCardDisconnect
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4be198045c73ec0deb79e66c0ca1738a
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scarddisconnect
/// 
/// 3. SCardSetAttrib
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardsetattrib
/// 
/// 4. SCardEndTransaction
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae8742473b404363e5c587f570d7e2f3b
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardendtransaction

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReportPlainResultParams {

    pub requestId: String,
}

impl ReportPlainResultParams { pub const METHOD: &'static str = "SmartCardEmulation.reportPlainResult"; }

impl crate::CdpCommand for ReportPlainResultParams {
    const METHOD: &'static str = "SmartCardEmulation.reportPlainResult";
    type Response = crate::EmptyReturns;
}

/// Reports the successful result of a |SCardConnect| call.
/// 
/// This maps to:
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardconnecta

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReportConnectResultParams {

    pub requestId: String,

    pub handle: i64,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub activeProtocol: Option<Protocol>,
}

impl ReportConnectResultParams { pub const METHOD: &'static str = "SmartCardEmulation.reportConnectResult"; }

impl crate::CdpCommand for ReportConnectResultParams {
    const METHOD: &'static str = "SmartCardEmulation.reportConnectResult";
    type Response = crate::EmptyReturns;
}

/// Reports the successful result of a call that sends back data on success.
/// Used for |SCardTransmit|, |SCardControl|, and |SCardGetAttrib|.
/// 
/// This maps to:
/// 1. SCardTransmit
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga9a2d77242a271310269065e64633ab99
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardtransmit
/// 
/// 2. SCardControl
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcontrol
/// 
/// 3. SCardGetAttrib
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacfec51917255b7a25b94c5104961602
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReportDataResultParams {

    pub requestId: String,

    pub data: String,
}

impl ReportDataResultParams { pub const METHOD: &'static str = "SmartCardEmulation.reportDataResult"; }

impl crate::CdpCommand for ReportDataResultParams {
    const METHOD: &'static str = "SmartCardEmulation.reportDataResult";
    type Response = crate::EmptyReturns;
}

/// Reports the successful result of a |SCardStatus| call.
/// 
/// This maps to:
/// PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382
/// Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardstatusa

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReportStatusResultParams {

    pub requestId: String,

    pub readerName: String,

    pub state: ConnectionState,

    pub atr: String,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub protocol: Option<Protocol>,
}

impl ReportStatusResultParams { pub const METHOD: &'static str = "SmartCardEmulation.reportStatusResult"; }

impl crate::CdpCommand for ReportStatusResultParams {
    const METHOD: &'static str = "SmartCardEmulation.reportStatusResult";
    type Response = crate::EmptyReturns;
}

/// Reports an error result for the given request.

#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ReportErrorParams {

    pub requestId: String,

    pub resultCode: ResultCode,
}

impl ReportErrorParams { pub const METHOD: &'static str = "SmartCardEmulation.reportError"; }

impl crate::CdpCommand for ReportErrorParams {
    const METHOD: &'static str = "SmartCardEmulation.reportError";
    type Response = crate::EmptyReturns;
}