-
Notifications
You must be signed in to change notification settings - Fork 1
/
nfc.h.preprocessed
376 lines (184 loc) · 7.58 KB
/
nfc.h.preprocessed
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
# 1 "libnfc/include/nfc/nfc.h"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 361 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "libnfc/include/nfc/nfc.h" 2
# 60 "libnfc/include/nfc/nfc.h"
# 1 "libnfc/include/nfc/nfc-types.h" 1
# 42 "libnfc/include/nfc/nfc-types.h"
typedef struct nfc_context nfc_context;
typedef struct nfc_device nfc_device;
typedef struct nfc_driver nfc_driver;
typedef char nfc_connstring[1024];
typedef enum {
NP_TIMEOUT_COMMAND,
NP_TIMEOUT_ATR,
NP_TIMEOUT_COM,
NP_HANDLE_CRC,
NP_HANDLE_PARITY,
NP_ACTIVATE_FIELD,
NP_ACTIVATE_CRYPTO1,
NP_INFINITE_SELECT,
NP_ACCEPT_INVALID_FRAMES,
NP_ACCEPT_MULTIPLE_FRAMES,
NP_AUTO_ISO14443_4,
NP_EASY_FRAMING,
NP_FORCE_ISO14443_A,
NP_FORCE_ISO14443_B,
NP_FORCE_SPEED_106,
} nfc_property;
#pragma pack(1)
typedef enum {
NDM_UNDEFINED = 0,
NDM_PASSIVE,
NDM_ACTIVE,
} nfc_dep_mode;
typedef struct {
uint8_t abtNFCID3[10];
uint8_t btDID;
uint8_t btBS;
uint8_t btBR;
uint8_t btTO;
uint8_t btPP;
uint8_t abtGB[48];
size_t szGB;
nfc_dep_mode ndm;
} nfc_dep_info;
typedef struct {
uint8_t abtAtqa[2];
uint8_t btSak;
size_t szUidLen;
uint8_t abtUid[10];
size_t szAtsLen;
uint8_t abtAts[254];
} nfc_iso14443a_info;
typedef struct {
size_t szLen;
uint8_t btResCode;
uint8_t abtId[8];
uint8_t abtPad[8];
uint8_t abtSysCode[2];
} nfc_felica_info;
typedef struct {
uint8_t abtPupi[4];
uint8_t abtApplicationData[4];
uint8_t abtProtocolInfo[3];
uint8_t ui8CardIdentifier;
} nfc_iso14443b_info;
typedef struct {
uint8_t abtDIV[4];
uint8_t btVerLog;
uint8_t btConfig;
size_t szAtrLen;
uint8_t abtAtr[33];
} nfc_iso14443bi_info;
typedef struct {
uint8_t abtUID[8];
} nfc_iso14443b2sr_info;
typedef struct {
uint8_t abtUID[4];
uint8_t btProdCode;
uint8_t btFabCode;
} nfc_iso14443b2ct_info;
typedef struct {
uint8_t btSensRes[2];
uint8_t btId[4];
} nfc_jewel_info;
typedef struct {
size_t szDataLen;
uint8_t abtData[32];
} nfc_barcode_info;
typedef union {
nfc_iso14443a_info nai;
nfc_felica_info nfi;
nfc_iso14443b_info nbi;
nfc_iso14443bi_info nii;
nfc_iso14443b2sr_info nsi;
nfc_iso14443b2ct_info nci;
nfc_jewel_info nji;
nfc_barcode_info nti;
nfc_dep_info ndi;
} nfc_target_info;
typedef enum {
NBR_UNDEFINED = 0,
NBR_106,
NBR_212,
NBR_424,
NBR_847,
} nfc_baud_rate;
typedef enum {
NMT_ISO14443A = 1,
NMT_JEWEL,
NMT_BARCODE,
NMT_ISO14443B,
NMT_ISO14443BI,
NMT_ISO14443B2SR,
NMT_ISO14443B2CT,
NMT_FELICA,
NMT_DEP,
} nfc_modulation_type;
typedef enum {
N_TARGET,
N_INITIATOR,
} nfc_mode;
typedef struct {
nfc_modulation_type nmt;
nfc_baud_rate nbr;
} nfc_modulation;
typedef struct {
nfc_target_info nti;
nfc_modulation nm;
} nfc_target;
#pragma pack()
# 61 "libnfc/include/nfc/nfc.h" 2
# 81 "libnfc/include/nfc/nfc.h"
void nfc_init(nfc_context **context) ;
void nfc_exit(nfc_context *context) ;
int nfc_register_driver(const nfc_driver *driver);
nfc_device *nfc_open(nfc_context *context, const nfc_connstring connstring) ;
void nfc_close(nfc_device *pnd);
int nfc_abort_command(nfc_device *pnd);
size_t nfc_list_devices(nfc_context *context, nfc_connstring connstrings[], size_t connstrings_len) ;
int nfc_idle(nfc_device *pnd);
int nfc_initiator_init(nfc_device *pnd);
int nfc_initiator_init_secure_element(nfc_device *pnd);
int nfc_initiator_select_passive_target(nfc_device *pnd, const nfc_modulation nm, const uint8_t *pbtInitData, const size_t szInitData, nfc_target *pnt);
int nfc_initiator_list_passive_targets(nfc_device *pnd, const nfc_modulation nm, nfc_target ant[], const size_t szTargets);
int nfc_initiator_poll_target(nfc_device *pnd, const nfc_modulation *pnmTargetTypes, const size_t szTargetTypes, const uint8_t uiPollNr, const uint8_t uiPeriod, nfc_target *pnt);
int nfc_initiator_select_dep_target(nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info *pndiInitiator, nfc_target *pnt, const int timeout);
int nfc_initiator_poll_dep_target(nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info *pndiInitiator, nfc_target *pnt, const int timeout);
int nfc_initiator_deselect_target(nfc_device *pnd);
int nfc_initiator_transceive_bytes(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRx, int timeout);
int nfc_initiator_transceive_bits(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, const size_t szRx, uint8_t *pbtRxPar);
int nfc_initiator_transceive_bytes_timed(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, uint8_t *pbtRx, const size_t szRx, uint32_t *cycles);
int nfc_initiator_transceive_bits_timed(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar, uint8_t *pbtRx, const size_t szRx, uint8_t *pbtRxPar, uint32_t *cycles);
int nfc_initiator_target_is_present(nfc_device *pnd, const nfc_target *pnt);
int nfc_target_init(nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, const size_t szRx, int timeout);
int nfc_target_send_bytes(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, int timeout);
int nfc_target_receive_bytes(nfc_device *pnd, uint8_t *pbtRx, const size_t szRx, int timeout);
int nfc_target_send_bits(nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, const uint8_t *pbtTxPar);
int nfc_target_receive_bits(nfc_device *pnd, uint8_t *pbtRx, const size_t szRx, uint8_t *pbtRxPar);
const char *nfc_strerror(const nfc_device *pnd);
int nfc_strerror_r(const nfc_device *pnd, char *buf, size_t buflen);
void nfc_perror(const nfc_device *pnd, const char *s);
int nfc_device_get_last_error(const nfc_device *pnd);
const char *nfc_device_get_name(nfc_device *pnd);
const char *nfc_device_get_connstring(nfc_device *pnd);
int nfc_device_get_supported_modulation(nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type **const supported_mt);
int nfc_device_get_supported_baud_rate(nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br);
int nfc_device_get_supported_baud_rate_target_mode(nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br);
int nfc_device_set_property_int(nfc_device *pnd, const nfc_property property, const int value);
int nfc_device_set_property_bool(nfc_device *pnd, const nfc_property property, const bool bEnable);
void iso14443a_crc(uint8_t *pbtData, size_t szLen, uint8_t *pbtCrc);
void iso14443a_crc_append(uint8_t *pbtData, size_t szLen);
void iso14443b_crc(uint8_t *pbtData, size_t szLen, uint8_t *pbtCrc);
void iso14443b_crc_append(uint8_t *pbtData, size_t szLen);
uint8_t *iso14443a_locate_historical_bytes(uint8_t *pbtAts, size_t szAts, size_t *pszTk);
void nfc_free(void *p);
const char *nfc_version(void);
int nfc_device_get_information_about(nfc_device *pnd, char **buf);
const char *str_nfc_modulation_type(const nfc_modulation_type nmt);
const char *str_nfc_baud_rate(const nfc_baud_rate nbr);
int str_nfc_target(char **buf, const nfc_target *pnt, bool verbose);