nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
apdu.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef NFC_T4T_APDU_H_
8#define NFC_T4T_APDU_H_
9
19#include <stdint.h>
20#include <string.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
27#define NFC_T4T_APDU_CLASS_BYTE_NO_SECURE_MSG 0x00
28
36#define NFC_T4T_APDU_SELECT_BY_FILE_ID 0x000C
37
39#define NFC_T4T_APDU_SELECT_BY_NAME 0x0400
50#define NFC_T4T_APDU_RAPDU_STATUS_CMD_COMPLETED 0x9000
51
53#define NFC_T4T_APDU_RAPDU_STATUS_SEL_ITEM_NOT_FOUND 0x6A82
54
71
76 uint16_t len;
77
79 uint8_t *buff;
80};
81
85 /* Class byte. */
86 uint8_t class_byte;
87
90
92 uint16_t parameter;
93
96
98 uint16_t resp_len;
99};
100
105 uint16_t status;
106
109};
110
115static inline void nfc_t4t_apdu_comm_clear(struct nfc_t4t_apdu_comm *cmd_apdu);
116
121static inline void nfc_t4t_apdu_resp_clear(struct nfc_t4t_apdu_resp *resp_apdu);
122
136 uint8_t *raw_data, uint16_t *len);
137
151 const uint8_t *raw_data, uint16_t len);
152
159void nfc_t4t_apdu_resp_printout(const struct nfc_t4t_apdu_resp *resp_apdu);
160
161static inline void nfc_t4t_apdu_comm_clear(struct nfc_t4t_apdu_comm *cmd_apdu)
162{
163 memset(cmd_apdu, 0, sizeof(struct nfc_t4t_apdu_comm));
164}
165
166static inline void nfc_t4t_apdu_resp_clear(struct nfc_t4t_apdu_resp *resp_apdu)
167{
168 memset(resp_apdu, 0, sizeof(struct nfc_t4t_apdu_resp));
169}
170
171#ifdef __cplusplus
172}
173#endif
174
179#endif /* NFC_T4T_APDU_H_ */
static void nfc_t4t_apdu_resp_clear(struct nfc_t4t_apdu_resp *resp_apdu)
Clearing an R-APDU descriptor and restore its default values.
Definition apdu.h:166
void nfc_t4t_apdu_resp_printout(const struct nfc_t4t_apdu_resp *resp_apdu)
Print an R-APDU descriptor.
static void nfc_t4t_apdu_comm_clear(struct nfc_t4t_apdu_comm *cmd_apdu)
Clear a C-APDU descriptor and restore its default values.
Definition apdu.h:161
nfc_t4t_apdu_comm_ins
Possible instruction codes in C-APDU.
Definition apdu.h:61
@ NFC_T4T_APDU_COMM_INS_UPDATE
Definition apdu.h:69
@ NFC_T4T_APDU_COMM_INS_READ
Definition apdu.h:66
@ NFC_T4T_APDU_COMM_INS_SELECT
Definition apdu.h:63
int nfc_t4t_apdu_comm_encode(const struct nfc_t4t_apdu_comm *cmd_apdu, uint8_t *raw_data, uint16_t *len)
Encode C-APDU.
int nfc_t4t_apdu_resp_decode(struct nfc_t4t_apdu_resp *resp_apdu, const uint8_t *raw_data, uint16_t len)
Decode R-APDU.
uint16_t resp_len
Definition apdu.h:98
uint16_t parameter
Definition apdu.h:92
uint8_t class_byte
Definition apdu.h:86
enum nfc_t4t_apdu_comm_ins instruction
Definition apdu.h:89
struct nfc_t4t_apdu_data data
Definition apdu.h:95
Command Application Protocol Data Unit (C-APDU) descriptor.
Definition apdu.h:84
uint16_t len
Definition apdu.h:76
uint8_t * buff
Definition apdu.h:79
APDU data field descriptor.
Definition apdu.h:74
uint16_t status
Definition apdu.h:105
struct nfc_t4t_apdu_data data
Definition apdu.h:108
Response Application Protocol Data Unit (R-APDU) descriptor.
Definition apdu.h:103