libnfc
1.8.0
include
nfc
nfc-types.h
Go to the documentation of this file.
1
/*-
2
* Free/Libre Near Field Communication (NFC) library
3
*
4
* Libnfc historical contributors:
5
* Copyright (C) 2009 Roel Verdult
6
* Copyright (C) 2009-2013 Romuald Conty
7
* Copyright (C) 2010-2012 Romain Tartière
8
* Copyright (C) 2010-2013 Philippe Teuwen
9
* Copyright (C) 2012-2013 Ludovic Rousseau
10
* See AUTHORS file for a more comprehensive list of contributors.
11
* Additional contributors of this file:
12
* Copyright (C) 2020 Adam Laurie
13
*
14
* This program is free software: you can redistribute it and/or modify it
15
* under the terms of the GNU Lesser General Public License as published by the
16
* Free Software Foundation, either version 3 of the License, or (at your
17
* option) any later version.
18
*
19
* This program is distributed in the hope that it will be useful, but WITHOUT
20
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
22
* more details.
23
*
24
* You should have received a copy of the GNU Lesser General Public License
25
* along with this program. If not, see <http://www.gnu.org/licenses/>
26
*/
27
33
#ifndef __NFC_TYPES_H__
34
#define __NFC_TYPES_H__
35
36
#include <stddef.h>
37
#include <stdint.h>
38
#include <stdbool.h>
39
#include <stdio.h>
40
41
#ifndef NFC_BUFSIZE_CONNSTRING
42
#define NFC_BUFSIZE_CONNSTRING 1024
43
#endif
44
48
typedef
struct
nfc_context
nfc_context
;
49
53
typedef
struct
nfc_device
nfc_device
;
54
58
typedef
struct
nfc_driver
nfc_driver
;
59
63
typedef
char
nfc_connstring
[NFC_BUFSIZE_CONNSTRING];
64
68
typedef
enum
{
74
NP_TIMEOUT_COMMAND
,
81
NP_TIMEOUT_ATR
,
86
NP_TIMEOUT_COM
,
94
NP_HANDLE_CRC
,
102
NP_HANDLE_PARITY
,
105
NP_ACTIVATE_FIELD
,
109
NP_ACTIVATE_CRYPTO1
,
115
NP_INFINITE_SELECT
,
119
NP_ACCEPT_INVALID_FRAMES
,
126
NP_ACCEPT_MULTIPLE_FRAMES
,
134
NP_AUTO_ISO14443_4
,
136
NP_EASY_FRAMING
,
138
NP_FORCE_ISO14443_A
,
140
NP_FORCE_ISO14443_B
,
142
NP_FORCE_SPEED_106
,
143
}
nfc_property
;
144
145
// Compiler directive, set struct alignment to 1 uint8_t for compatibility
146
# pragma pack(1)
147
152
typedef
enum
{
153
NDM_UNDEFINED = 0,
154
NDM_PASSIVE,
155
NDM_ACTIVE,
156
}
nfc_dep_mode
;
157
162
typedef
struct
{
164
uint8_t abtNFCID3[10];
166
uint8_t
btDID
;
168
uint8_t
btBS
;
170
uint8_t
btBR
;
172
uint8_t
btTO
;
174
uint8_t
btPP
;
176
uint8_t abtGB[48];
177
size_t
szGB;
179
nfc_dep_mode
ndm
;
180
}
nfc_dep_info
;
181
186
typedef
struct
{
187
uint8_t abtAtqa[2];
188
uint8_t btSak;
189
size_t
szUidLen;
190
uint8_t abtUid[10];
191
size_t
szAtsLen;
192
uint8_t abtAts[254];
// Maximal theoretical ATS is FSD-2, FSD=256 for FSDI=8 in RATS
193
}
nfc_iso14443a_info
;
194
199
typedef
struct
{
200
size_t
szLen;
201
uint8_t btResCode;
202
uint8_t abtId[8];
203
uint8_t abtPad[8];
204
uint8_t abtSysCode[2];
205
}
nfc_felica_info
;
206
211
typedef
struct
{
213
uint8_t abtPupi[4];
215
uint8_t abtApplicationData[4];
217
uint8_t abtProtocolInfo[3];
219
uint8_t
ui8CardIdentifier
;
220
}
nfc_iso14443b_info
;
221
226
typedef
struct
{
228
uint8_t abtDIV[4];
230
uint8_t
btVerLog
;
232
uint8_t
btConfig
;
234
size_t
szAtrLen
;
235
uint8_t abtAtr[33];
236
}
nfc_iso14443bi_info
;
237
242
typedef
struct
{
243
uint8_t abtUID[8];
244
}
nfc_iso14443biclass_info
;
245
250
typedef
struct
{
251
uint8_t abtUID[8];
252
}
nfc_iso14443b2sr_info
;
253
258
typedef
struct
{
259
uint8_t abtUID[4];
260
uint8_t btProdCode;
261
uint8_t btFabCode;
262
}
nfc_iso14443b2ct_info
;
263
268
typedef
struct
{
269
uint8_t btSensRes[2];
270
uint8_t btId[4];
271
}
nfc_jewel_info
;
272
277
typedef
struct
{
278
size_t
szDataLen;
279
uint8_t abtData[32];
280
}
nfc_barcode_info
;
281
286
typedef
union
{
287
nfc_iso14443a_info
nai;
288
nfc_felica_info
nfi;
289
nfc_iso14443b_info
nbi;
290
nfc_iso14443bi_info
nii;
291
nfc_iso14443b2sr_info
nsi;
292
nfc_iso14443b2ct_info
nci;
293
nfc_jewel_info
nji;
294
nfc_dep_info
ndi;
295
nfc_barcode_info
nti;
// "t" for Thinfilm, "b" already used
296
nfc_iso14443biclass_info
nhi;
// hid iclass / picopass - nii already used
297
}
nfc_target_info
;
298
303
typedef
enum
{
304
NBR_UNDEFINED = 0,
305
NBR_106,
306
NBR_212,
307
NBR_424,
308
NBR_847,
309
}
nfc_baud_rate
;
310
315
typedef
enum
{
316
NMT_ISO14443A = 1,
317
NMT_JEWEL,
318
NMT_ISO14443B,
319
NMT_ISO14443BI,
// pre-ISO14443B aka ISO/IEC 14443 B' or Type B'
320
NMT_ISO14443B2SR,
// ISO14443-2B ST SRx
321
NMT_ISO14443B2CT,
// ISO14443-2B ASK CTx
322
NMT_FELICA,
323
NMT_DEP,
324
NMT_BARCODE,
// Thinfilm NFC Barcode
325
NMT_ISO14443BICLASS,
// HID iClass 14443B mode
326
NMT_END_ENUM = NMT_ISO14443BICLASS,
// dummy for sizing - always should alias last
327
}
nfc_modulation_type
;
328
333
typedef
enum
{
334
N_TARGET,
335
N_INITIATOR,
336
}
nfc_mode
;
337
342
typedef
struct
{
343
nfc_modulation_type
nmt;
344
nfc_baud_rate
nbr;
345
}
nfc_modulation
;
346
351
typedef
struct
{
352
nfc_target_info
nti;
353
nfc_modulation
nm;
354
}
nfc_target
;
355
356
// Reset struct alignment to default
357
# pragma pack()
358
359
#endif
// _LIBNFC_TYPES_H_
nfc_mode
nfc_mode
NFC mode type enumeration.
Definition:
nfc-types.h:333
nfc_driver
struct nfc_driver nfc_driver
Definition:
nfc-types.h:58
nfc_property
nfc_property
Definition:
nfc-types.h:68
NP_TIMEOUT_ATR
@ NP_TIMEOUT_ATR
Definition:
nfc-types.h:81
NP_TIMEOUT_COMMAND
@ NP_TIMEOUT_COMMAND
Definition:
nfc-types.h:74
NP_INFINITE_SELECT
@ NP_INFINITE_SELECT
Definition:
nfc-types.h:115
NP_HANDLE_CRC
@ NP_HANDLE_CRC
Definition:
nfc-types.h:94
NP_FORCE_ISO14443_A
@ NP_FORCE_ISO14443_A
Definition:
nfc-types.h:138
NP_ACCEPT_INVALID_FRAMES
@ NP_ACCEPT_INVALID_FRAMES
Definition:
nfc-types.h:119
NP_ACTIVATE_FIELD
@ NP_ACTIVATE_FIELD
Definition:
nfc-types.h:105
NP_TIMEOUT_COM
@ NP_TIMEOUT_COM
Definition:
nfc-types.h:86
NP_AUTO_ISO14443_4
@ NP_AUTO_ISO14443_4
Definition:
nfc-types.h:134
NP_EASY_FRAMING
@ NP_EASY_FRAMING
Definition:
nfc-types.h:136
NP_ACTIVATE_CRYPTO1
@ NP_ACTIVATE_CRYPTO1
Definition:
nfc-types.h:109
NP_FORCE_ISO14443_B
@ NP_FORCE_ISO14443_B
Definition:
nfc-types.h:140
NP_ACCEPT_MULTIPLE_FRAMES
@ NP_ACCEPT_MULTIPLE_FRAMES
Definition:
nfc-types.h:126
NP_HANDLE_PARITY
@ NP_HANDLE_PARITY
Definition:
nfc-types.h:102
NP_FORCE_SPEED_106
@ NP_FORCE_SPEED_106
Definition:
nfc-types.h:142
nfc_connstring
char nfc_connstring[NFC_BUFSIZE_CONNSTRING]
Definition:
nfc-types.h:63
nfc_dep_mode
nfc_dep_mode
NFC D.E.P. (Data Exchange Protocol) active/passive mode.
Definition:
nfc-types.h:152
nfc_modulation_type
nfc_modulation_type
NFC modulation type enumeration.
Definition:
nfc-types.h:315
nfc_baud_rate
nfc_baud_rate
NFC baud rate enumeration.
Definition:
nfc-types.h:303
nfc_barcode_info
Thinfilm NFC Barcode information.
Definition:
nfc-types.h:277
nfc_context
NFC library context Struct which contains internal options, references, pointers, etc....
Definition:
nfc-internal.h:175
nfc_dep_info
NFC target information in D.E.P. (Data Exchange Protocol) see ISO/IEC 18092 (NFCIP-1)
Definition:
nfc-types.h:162
nfc_dep_info::btPP
uint8_t btPP
Definition:
nfc-types.h:174
nfc_dep_info::btDID
uint8_t btDID
Definition:
nfc-types.h:166
nfc_dep_info::ndm
nfc_dep_mode ndm
Definition:
nfc-types.h:179
nfc_dep_info::btTO
uint8_t btTO
Definition:
nfc-types.h:172
nfc_dep_info::btBS
uint8_t btBS
Definition:
nfc-types.h:168
nfc_dep_info::btBR
uint8_t btBR
Definition:
nfc-types.h:170
nfc_device
NFC device information.
Definition:
nfc-internal.h:190
nfc_felica_info
NFC FeLiCa tag information.
Definition:
nfc-types.h:199
nfc_iso14443a_info
NFC ISO14443A tag (MIFARE) information.
Definition:
nfc-types.h:186
nfc_iso14443b2ct_info
NFC ISO14443-2B ASK CTx tag information.
Definition:
nfc-types.h:258
nfc_iso14443b2sr_info
NFC ISO14443-2B ST SRx tag information.
Definition:
nfc-types.h:250
nfc_iso14443b_info
NFC ISO14443B tag information.
Definition:
nfc-types.h:211
nfc_iso14443b_info::ui8CardIdentifier
uint8_t ui8CardIdentifier
Definition:
nfc-types.h:219
nfc_iso14443bi_info
NFC ISO14443B' tag information.
Definition:
nfc-types.h:226
nfc_iso14443bi_info::szAtrLen
size_t szAtrLen
Definition:
nfc-types.h:234
nfc_iso14443bi_info::btVerLog
uint8_t btVerLog
Definition:
nfc-types.h:230
nfc_iso14443bi_info::btConfig
uint8_t btConfig
Definition:
nfc-types.h:232
nfc_iso14443biclass_info
NFC ISO14443BiClass tag information.
Definition:
nfc-types.h:242
nfc_jewel_info
NFC Jewel tag information.
Definition:
nfc-types.h:268
nfc_modulation
NFC modulation structure.
Definition:
nfc-types.h:342
nfc_target
NFC target structure.
Definition:
nfc-types.h:351
nfc_target_info
Union between all kind of tags information structures.
Definition:
nfc-types.h:286
Generated by
1.9.1