|
libnfc
1.7.0-rc7
|
00001 /*- 00002 * Free/Libre Near Field Communication (NFC) library 00003 * 00004 * Libnfc historical contributors: 00005 * Copyright (C) 2009 Roel Verdult 00006 * Copyright (C) 2009-2013 Romuald Conty 00007 * Copyright (C) 2010-2012 Romain Tartière 00008 * Copyright (C) 2010-2013 Philippe Teuwen 00009 * Copyright (C) 2012-2013 Ludovic Rousseau 00010 * Additional contributors of this file: 00011 * 00012 * This program is free software: you can redistribute it and/or modify it 00013 * under the terms of the GNU Lesser General Public License as published by the 00014 * Free Software Foundation, either version 3 of the License, or (at your 00015 * option) any later version. 00016 * 00017 * This program is distributed in the hope that it will be useful, but WITHOUT 00018 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00019 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00020 * more details. 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * along with this program. If not, see <http://www.gnu.org/licenses/> 00024 */ 00025 00031 #ifndef __NFC_TYPES_H__ 00032 #define __NFC_TYPES_H__ 00033 00034 #include <stddef.h> 00035 #include <stdint.h> 00036 #include <stdbool.h> 00037 #include <stdio.h> 00038 00039 #ifndef NFC_BUFSIZE_CONNSTRING 00040 #define NFC_BUFSIZE_CONNSTRING 1024 00041 #endif 00042 00046 typedef struct nfc_context nfc_context; 00047 00051 typedef struct nfc_device nfc_device; 00052 00056 typedef struct nfc_driver nfc_driver; 00057 00061 typedef char nfc_connstring[NFC_BUFSIZE_CONNSTRING]; 00062 00066 typedef enum { 00072 NP_TIMEOUT_COMMAND, 00079 NP_TIMEOUT_ATR, 00084 NP_TIMEOUT_COM, 00092 NP_HANDLE_CRC, 00100 NP_HANDLE_PARITY, 00103 NP_ACTIVATE_FIELD, 00107 NP_ACTIVATE_CRYPTO1, 00113 NP_INFINITE_SELECT, 00117 NP_ACCEPT_INVALID_FRAMES, 00124 NP_ACCEPT_MULTIPLE_FRAMES, 00132 NP_AUTO_ISO14443_4, 00134 NP_EASY_FRAMING, 00136 NP_FORCE_ISO14443_A, 00138 NP_FORCE_ISO14443_B, 00140 NP_FORCE_SPEED_106, 00141 } nfc_property; 00142 00143 // Compiler directive, set struct alignment to 1 uint8_t for compatibility 00144 # pragma pack(1) 00145 00150 typedef enum { 00151 NDM_UNDEFINED = 0, 00152 NDM_PASSIVE, 00153 NDM_ACTIVE, 00154 } nfc_dep_mode; 00155 00160 typedef struct { 00162 uint8_t abtNFCID3[10]; 00164 uint8_t btDID; 00166 uint8_t btBS; 00168 uint8_t btBR; 00170 uint8_t btTO; 00172 uint8_t btPP; 00174 uint8_t abtGB[48]; 00175 size_t szGB; 00177 nfc_dep_mode ndm; 00178 } nfc_dep_info; 00179 00184 typedef struct { 00185 uint8_t abtAtqa[2]; 00186 uint8_t btSak; 00187 size_t szUidLen; 00188 uint8_t abtUid[10]; 00189 size_t szAtsLen; 00190 uint8_t abtAts[254]; // Maximal theoretical ATS is FSD-2, FSD=256 for FSDI=8 in RATS 00191 } nfc_iso14443a_info; 00192 00197 typedef struct { 00198 size_t szLen; 00199 uint8_t btResCode; 00200 uint8_t abtId[8]; 00201 uint8_t abtPad[8]; 00202 uint8_t abtSysCode[2]; 00203 } nfc_felica_info; 00204 00209 typedef struct { 00211 uint8_t abtPupi[4]; 00213 uint8_t abtApplicationData[4]; 00215 uint8_t abtProtocolInfo[3]; 00217 uint8_t ui8CardIdentifier; 00218 } nfc_iso14443b_info; 00219 00224 typedef struct { 00226 uint8_t abtDIV[4]; 00228 uint8_t btVerLog; 00230 uint8_t btConfig; 00232 size_t szAtrLen; 00233 uint8_t abtAtr[33]; 00234 } nfc_iso14443bi_info; 00235 00240 typedef struct { 00241 uint8_t abtUID[8]; 00242 } nfc_iso14443b2sr_info; 00243 00248 typedef struct { 00249 uint8_t abtUID[4]; 00250 uint8_t btProdCode; 00251 uint8_t btFabCode; 00252 } nfc_iso14443b2ct_info; 00253 00258 typedef struct { 00259 uint8_t btSensRes[2]; 00260 uint8_t btId[4]; 00261 } nfc_jewel_info; 00262 00267 typedef union { 00268 nfc_iso14443a_info nai; 00269 nfc_felica_info nfi; 00270 nfc_iso14443b_info nbi; 00271 nfc_iso14443bi_info nii; 00272 nfc_iso14443b2sr_info nsi; 00273 nfc_iso14443b2ct_info nci; 00274 nfc_jewel_info nji; 00275 nfc_dep_info ndi; 00276 } nfc_target_info; 00277 00282 typedef enum { 00283 NBR_UNDEFINED = 0, 00284 NBR_106, 00285 NBR_212, 00286 NBR_424, 00287 NBR_847, 00288 } nfc_baud_rate; 00289 00294 typedef enum { 00295 NMT_ISO14443A = 1, 00296 NMT_JEWEL, 00297 NMT_ISO14443B, 00298 NMT_ISO14443BI, // pre-ISO14443B aka ISO/IEC 14443 B' or Type B' 00299 NMT_ISO14443B2SR, // ISO14443-2B ST SRx 00300 NMT_ISO14443B2CT, // ISO14443-2B ASK CTx 00301 NMT_FELICA, 00302 NMT_DEP, 00303 } nfc_modulation_type; 00304 00309 typedef enum { 00310 N_TARGET, 00311 N_INITIATOR, 00312 } nfc_mode; 00313 00318 typedef struct { 00319 nfc_modulation_type nmt; 00320 nfc_baud_rate nbr; 00321 } nfc_modulation; 00322 00327 typedef struct { 00328 nfc_target_info nti; 00329 nfc_modulation nm; 00330 } nfc_target; 00331 00332 // Reset struct alignment to default 00333 # pragma pack() 00334 00335 #endif // _LIBNFC_TYPES_H_
1.7.6.1