]>
Commit | Line | Data |
---|---|---|
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 | //----------------------------------------------------------------------------- | |
10 | ||
11 | #ifndef _NDEF_H_ | |
12 | #define _NDEF_H_ | |
13 | ||
14 | #include <stdint.h> | |
15 | #include <stdbool.h> | |
16 | #include <stddef.h> | |
17 | ||
18 | typedef enum { | |
19 | tnfEmptyRecord = 0x00, | |
20 | tnfWellKnownRecord = 0x01, | |
21 | tnfMIMEMediaRecord = 0x02, | |
22 | tnfAbsoluteURIRecord = 0x03, | |
23 | tnfExternalRecord = 0x04, | |
24 | tnfUnknownRecord = 0x05, | |
25 | tnfUnchangedRecord = 0x06 | |
26 | } TypeNameFormat_t; | |
27 | ||
28 | typedef enum { | |
29 | stNotPresent = 0x00, | |
30 | stRSASSA_PSS_SHA_1 = 0x01, | |
31 | stRSASSA_PKCS1_v1_5_WITH_SHA_1 = 0x02, | |
32 | stDSA = 0x03, | |
33 | stECDSA = 0x04, | |
34 | stNA = 0x05 | |
35 | } ndefSigType_t; | |
36 | ||
37 | typedef enum { | |
38 | sfX_509 = 0x00, | |
39 | sfX9_68 = 0x01, | |
40 | sfNA = 0x02 | |
41 | } ndefCertificateFormat_t; | |
42 | ||
43 | typedef struct { | |
44 | bool MessageBegin; | |
45 | bool MessageEnd; | |
46 | bool ChunkFlag; | |
47 | bool ShortRecordBit; | |
48 | bool IDLenPresent; | |
49 | TypeNameFormat_t TypeNameFormat; | |
50 | size_t TypeLen; | |
51 | size_t PayloadLen; | |
52 | size_t IDLen; | |
53 | size_t len; | |
54 | size_t RecLen; | |
55 | uint8_t *Type; | |
56 | uint8_t *Payload; | |
57 | uint8_t *ID; | |
58 | } NDEFHeader_t; | |
59 | ||
60 | extern int NDEFDecodeAndPrint(uint8_t *ndef, size_t ndefLen, bool verbose); | |
61 | ||
62 | #endif // _NDEF_H_ |