libnfc
1.7.1
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
*
13
* This program is free software: you can redistribute it and/or modify it
14
* under the terms of the GNU Lesser General Public License as published by the
15
* Free Software Foundation, either version 3 of the License, or (at your
16
* option) any later version.
17
*
18
* This program is distributed in the hope that it will be useful, but WITHOUT
19
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
21
* more details.
22
*
23
* You should have received a copy of the GNU Lesser General Public License
24
* along with this program. If not, see <http://www.gnu.org/licenses/>
25
*/
26
32
#ifndef __NFC_TYPES_H__
33
#define __NFC_TYPES_H__
34
35
#include <stddef.h>
36
#include <stdint.h>
37
#include <stdbool.h>
38
#include <stdio.h>
39
40
#ifndef NFC_BUFSIZE_CONNSTRING
41
#define NFC_BUFSIZE_CONNSTRING 1024
42
#endif
43
47
typedef
struct
nfc_context
nfc_context
;
48
52
typedef
struct
nfc_device
nfc_device
;
53
57
typedef
struct
nfc_driver
nfc_driver
;
58
62
typedef
char
nfc_connstring
[NFC_BUFSIZE_CONNSTRING];
63
67
typedef
enum
{
73
NP_TIMEOUT_COMMAND
,
80
NP_TIMEOUT_ATR
,
85
NP_TIMEOUT_COM
,
93
NP_HANDLE_CRC
,
101
NP_HANDLE_PARITY
,
104
NP_ACTIVATE_FIELD
,
108
NP_ACTIVATE_CRYPTO1
,
114
NP_INFINITE_SELECT
,
118
NP_ACCEPT_INVALID_FRAMES
,
125
NP_ACCEPT_MULTIPLE_FRAMES
,
133
NP_AUTO_ISO14443_4
,
135
NP_EASY_FRAMING
,
137
NP_FORCE_ISO14443_A
,
139
NP_FORCE_ISO14443_B
,
141
NP_FORCE_SPEED_106
,
142
}
nfc_property
;
143
144
// Compiler directive, set struct alignment to 1 uint8_t for compatibility
145
# pragma pack(1)
146
151
typedef
enum
{
152
NDM_UNDEFINED = 0,
153
NDM_PASSIVE,
154
NDM_ACTIVE,
155
}
nfc_dep_mode
;
156
161
typedef
struct
{
163
uint8_t abtNFCID3[10];
165
uint8_t
btDID
;
167
uint8_t
btBS
;
169
uint8_t
btBR
;
171
uint8_t
btTO
;
173
uint8_t
btPP
;
175
uint8_t abtGB[48];
176
size_t
szGB;
178
nfc_dep_mode
ndm
;
179
}
nfc_dep_info
;
180
185
typedef
struct
{
186
uint8_t abtAtqa[2];
187
uint8_t btSak;
188
size_t
szUidLen;
189
uint8_t abtUid[10];
190
size_t
szAtsLen;
191
uint8_t abtAts[254];
// Maximal theoretical ATS is FSD-2, FSD=256 for FSDI=8 in RATS
192
}
nfc_iso14443a_info
;
193
198
typedef
struct
{
199
size_t
szLen;
200
uint8_t btResCode;
201
uint8_t abtId[8];
202
uint8_t abtPad[8];
203
uint8_t abtSysCode[2];
204
}
nfc_felica_info
;
205
210
typedef
struct
{
212
uint8_t abtPupi[4];
214
uint8_t abtApplicationData[4];
216
uint8_t abtProtocolInfo[3];
218
uint8_t
ui8CardIdentifier
;
219
}
nfc_iso14443b_info
;
220
225
typedef
struct
{
227
uint8_t abtDIV[4];
229
uint8_t
btVerLog
;
231
uint8_t
btConfig
;
233
size_t
szAtrLen
;
234
uint8_t abtAtr[33];
235
}
nfc_iso14443bi_info
;
236
241
typedef
struct
{
242
uint8_t abtUID[8];
243
}
nfc_iso14443b2sr_info
;
244
249
typedef
struct
{
250
uint8_t abtUID[4];
251
uint8_t btProdCode;
252
uint8_t btFabCode;
253
}
nfc_iso14443b2ct_info
;
254
259
typedef
struct
{
260
uint8_t btSensRes[2];
261
uint8_t btId[4];
262
}
nfc_jewel_info
;
263
268
typedef
union
{
269
nfc_iso14443a_info
nai;
270
nfc_felica_info
nfi;
271
nfc_iso14443b_info
nbi;
272
nfc_iso14443bi_info
nii;
273
nfc_iso14443b2sr_info
nsi;
274
nfc_iso14443b2ct_info
nci;
275
nfc_jewel_info
nji;
276
nfc_dep_info
ndi;
277
}
nfc_target_info
;
278
283
typedef
enum
{
284
NBR_UNDEFINED = 0,
285
NBR_106,
286
NBR_212,
287
NBR_424,
288
NBR_847,
289
}
nfc_baud_rate
;
290
295
typedef
enum
{
296
NMT_ISO14443A = 1,
297
NMT_JEWEL,
298
NMT_ISO14443B,
299
NMT_ISO14443BI,
// pre-ISO14443B aka ISO/IEC 14443 B' or Type B'
300
NMT_ISO14443B2SR,
// ISO14443-2B ST SRx
301
NMT_ISO14443B2CT,
// ISO14443-2B ASK CTx
302
NMT_FELICA,
303
NMT_DEP,
304
}
nfc_modulation_type
;
305
310
typedef
enum
{
311
N_TARGET,
312
N_INITIATOR,
313
}
nfc_mode
;
314
319
typedef
struct
{
320
nfc_modulation_type
nmt;
321
nfc_baud_rate
nbr;
322
}
nfc_modulation
;
323
328
typedef
struct
{
329
nfc_target_info
nti;
330
nfc_modulation
nm;
331
}
nfc_target
;
332
333
// Reset struct alignment to default
334
# pragma pack()
335
336
#endif // _LIBNFC_TYPES_H_
nfc_dep_info::btBR
uint8_t btBR
Definition:
nfc-types.h:169
nfc_context
NFC library context Struct which contains internal options, references, pointers, etc....
Definition:
nfc-internal.h:175
nfc_driver
struct nfc_driver nfc_driver
Definition:
nfc-types.h:57
nfc_device
NFC device information.
Definition:
nfc-internal.h:190
nfc_dep_info::ndm
nfc_dep_mode ndm
Definition:
nfc-types.h:178
nfc_iso14443b_info
NFC ISO14443B tag information.
Definition:
nfc-types.h:210
NP_INFINITE_SELECT
@ NP_INFINITE_SELECT
Definition:
nfc-types.h:114
nfc_jewel_info
NFC Jewel tag information.
Definition:
nfc-types.h:259
NP_HANDLE_CRC
@ NP_HANDLE_CRC
Definition:
nfc-types.h:93
nfc_dep_info
NFC target information in D.E.P. (Data Exchange Protocol) see ISO/IEC 18092 (NFCIP-1)
Definition:
nfc-types.h:161
NP_TIMEOUT_COMMAND
@ NP_TIMEOUT_COMMAND
Definition:
nfc-types.h:73
NP_ACCEPT_INVALID_FRAMES
@ NP_ACCEPT_INVALID_FRAMES
Definition:
nfc-types.h:118
nfc_target
NFC target structure.
Definition:
nfc-types.h:328
nfc_dep_info::btPP
uint8_t btPP
Definition:
nfc-types.h:173
nfc_iso14443b2sr_info
NFC ISO14443-2B ST SRx tag information.
Definition:
nfc-types.h:241
nfc_iso14443b2ct_info
NFC ISO14443-2B ASK CTx tag information.
Definition:
nfc-types.h:249
nfc_dep_mode
nfc_dep_mode
NFC D.E.P. (Data Exchange Protocol) active/passive mode.
Definition:
nfc-types.h:151
nfc_modulation
NFC modulation structure.
Definition:
nfc-types.h:319
nfc_connstring
char nfc_connstring[NFC_BUFSIZE_CONNSTRING]
Definition:
nfc-types.h:62
NP_FORCE_ISO14443_B
@ NP_FORCE_ISO14443_B
Definition:
nfc-types.h:139
nfc_dep_info::btDID
uint8_t btDID
Definition:
nfc-types.h:165
nfc_baud_rate
nfc_baud_rate
NFC baud rate enumeration.
Definition:
nfc-types.h:283
nfc_iso14443bi_info::btVerLog
uint8_t btVerLog
Definition:
nfc-types.h:229
NP_FORCE_SPEED_106
@ NP_FORCE_SPEED_106
Definition:
nfc-types.h:141
nfc_iso14443bi_info
NFC ISO14443B' tag information.
Definition:
nfc-types.h:225
NP_TIMEOUT_ATR
@ NP_TIMEOUT_ATR
Definition:
nfc-types.h:80
NP_ACTIVATE_CRYPTO1
@ NP_ACTIVATE_CRYPTO1
Definition:
nfc-types.h:108
NP_TIMEOUT_COM
@ NP_TIMEOUT_COM
Definition:
nfc-types.h:85
NP_FORCE_ISO14443_A
@ NP_FORCE_ISO14443_A
Definition:
nfc-types.h:137
NP_AUTO_ISO14443_4
@ NP_AUTO_ISO14443_4
Definition:
nfc-types.h:133
nfc_iso14443a_info
NFC ISO14443A tag (MIFARE) information.
Definition:
nfc-types.h:185
nfc_dep_info::btTO
uint8_t btTO
Definition:
nfc-types.h:171
nfc_felica_info
NFC FeLiCa tag information.
Definition:
nfc-types.h:198
nfc_iso14443bi_info::szAtrLen
size_t szAtrLen
Definition:
nfc-types.h:233
nfc_modulation_type
nfc_modulation_type
NFC modulation type enumeration.
Definition:
nfc-types.h:295
nfc_iso14443b_info::ui8CardIdentifier
uint8_t ui8CardIdentifier
Definition:
nfc-types.h:218
nfc_dep_info::btBS
uint8_t btBS
Definition:
nfc-types.h:167
nfc_mode
nfc_mode
NFC mode type enumeration.
Definition:
nfc-types.h:310
NP_EASY_FRAMING
@ NP_EASY_FRAMING
Definition:
nfc-types.h:135
nfc_iso14443bi_info::btConfig
uint8_t btConfig
Definition:
nfc-types.h:231
nfc_property
nfc_property
Definition:
nfc-types.h:67
nfc_target_info
Union between all kind of tags information structures.
Definition:
nfc-types.h:268
NP_HANDLE_PARITY
@ NP_HANDLE_PARITY
Definition:
nfc-types.h:101
NP_ACTIVATE_FIELD
@ NP_ACTIVATE_FIELD
Definition:
nfc-types.h:104
NP_ACCEPT_MULTIPLE_FRAMES
@ NP_ACCEPT_MULTIPLE_FRAMES
Definition:
nfc-types.h:125
Generated by
1.8.17