507
|
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
|
|
27 /**
|
|
28 * @file nfc-emulation.h
|
|
29 * @brief Provide a small API to ease emulation in libnfc
|
|
30 */
|
|
31
|
|
32 #ifndef __NFC_EMULATION_H__
|
|
33 #define __NFC_EMULATION_H__
|
|
34
|
|
35 #include <sys/types.h>
|
|
36 #include <nfc/nfc.h>
|
|
37
|
|
38 #ifdef __cplusplus
|
|
39 extern "C" {
|
|
40 #endif /* __cplusplus */
|
|
41
|
|
42 struct nfc_emulator;
|
|
43 struct nfc_emulation_state_machine;
|
|
44
|
|
45 /**
|
|
46 * @struct nfc_emulator
|
|
47 * @brief NFC emulator structure
|
|
48 */
|
|
49 struct nfc_emulator {
|
|
50 nfc_target *target;
|
|
51 struct nfc_emulation_state_machine *state_machine;
|
|
52 void *user_data;
|
|
53 };
|
|
54
|
|
55 /**
|
|
56 * @struct nfc_emulation_state_machine
|
|
57 * @brief NFC emulation state machine structure
|
|
58 */
|
|
59 struct nfc_emulation_state_machine {
|
|
60 int (*io)(struct nfc_emulator *emulator, const uint8_t *data_in, const size_t data_in_len, uint8_t *data_out, const size_t data_out_len);
|
|
61 void *data;
|
|
62 };
|
|
63
|
|
64 NFC_EXPORT int nfc_emulate_target(nfc_device *pnd, struct nfc_emulator *emulator, const int timeout);
|
|
65
|
|
66 #ifdef __cplusplus
|
|
67 }
|
|
68 #endif /* __cplusplus */
|
|
69
|
|
70
|
|
71 #endif /* __NFC_EMULATION_H__ */
|