fix little endian vs big endian in the macros... again... but this time correct
[RRG-proxmark3.git] / client / src / iso7816 / iso7816core.h
blobbeb5e3e901049b7884406432654a361286b79646
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2017 Merlok
3 //
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
6 // the license.
7 //-----------------------------------------------------------------------------
8 // ISO7816 core functionality
9 //-----------------------------------------------------------------------------
11 #ifndef ISO7816CORE_H__
12 #define ISO7816CORE_H__
14 #include "common.h"
15 #include <inttypes.h>
16 #include "apduinfo.h"
18 #define APDU_RES_LEN 260
19 #define APDU_AID_LEN 50
21 typedef enum {
22 ISODEP_INACTIVE = 0,
23 ISODEP_NFCA,
24 ISODEP_NFCB,
25 } isodep_state_t;
27 typedef enum {
28 CC_CONTACTLESS,
29 CC_CONTACT
30 } Iso7816CommandChannel;
32 void SetAPDULogging(bool logging);
33 bool GetAPDULogging(void);
35 void SetISODEPState(isodep_state_t state);
36 isodep_state_t GetISODEPState(void);
38 // connect
39 int Iso7816Connect(Iso7816CommandChannel channel);
41 // exchange
42 int Iso7816Exchange(Iso7816CommandChannel channel, bool leave_field_on, sAPDU apdu, uint8_t *result, size_t max_result_len,
43 size_t *result_len, uint16_t *sw);
45 int Iso7816ExchangeEx(Iso7816CommandChannel channel, bool activate_field, bool leave_field_on, sAPDU apdu, bool include_le,
46 uint16_t le, uint8_t *result, size_t max_result_len, size_t *result_len, uint16_t *sw);
48 // search application
49 int Iso7816Select(Iso7816CommandChannel channel, bool activate_field, bool leave_field_on, uint8_t *aid, size_t aid_len,
50 uint8_t *result, size_t max_result_len, size_t *result_len, uint16_t *sw);
52 #endif