fix little endian vs big endian in the macros... again... but this time correct
[RRG-proxmark3.git] / client / src / nfc / ndef.h
blobdc2f2aa876fe724ade43650af22817af87859e20
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2019 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 // NFC Data Exchange Format (NDEF) functions
9 //-----------------------------------------------------------------------------
11 #ifndef _NDEF_H_
12 #define _NDEF_H_
14 #include <stdbool.h>
15 #include "common.h"
17 typedef enum {
18 tnfEmptyRecord = 0x00,
19 tnfWellKnownRecord = 0x01,
20 tnfMIMEMediaRecord = 0x02,
21 tnfAbsoluteURIRecord = 0x03,
22 tnfExternalRecord = 0x04,
23 tnfUnknownRecord = 0x05,
24 tnfUnchangedRecord = 0x06
25 } TypeNameFormat_t;
27 typedef enum {
28 stNotPresent = 0x00,
29 stRSASSA_PSS_SHA_1 = 0x01,
30 stRSASSA_PKCS1_v1_5_WITH_SHA_1 = 0x02,
31 stDSA_1024 = 0x03,
32 stECDSA_P192 = 0x04,
33 stRSASSA_PSS_2048 = 0x05,
34 stRSASSA_PKCS1_v1_5_2048 = 0x06,
35 stDSA_2048 = 0x07,
36 stECDSA_P224 = 0x08,
37 stECDSA_K233 = 0x09,
38 stECDSA_B233 = 0x0a,
39 stECDSA_P256 = 0x0b,
40 stNA = 0x0c
41 } ndefSigType_t;
43 typedef enum {
44 sfX_509 = 0x00,
45 sfX9_68 = 0x01,
46 sfNA = 0x02
47 } ndefCertificateFormat_t;
49 typedef struct {
50 bool MessageBegin;
51 bool MessageEnd;
52 bool ChunkFlag;
53 bool ShortRecordBit;
54 bool IDLenPresent;
55 TypeNameFormat_t TypeNameFormat;
56 size_t TypeLen;
57 size_t PayloadLen;
58 size_t IDLen;
59 size_t len;
60 size_t RecLen;
61 uint8_t *Type;
62 uint8_t *Payload;
63 uint8_t *ID;
64 } NDEFHeader_t;
66 int NDEFDecodeAndPrint(uint8_t *ndef, size_t ndefLen, bool verbose);
67 int NDEFRecordsDecodeAndPrint(uint8_t *ndefRecord, size_t ndefRecordLen);
69 #endif // _NDEF_H_