fix little endian vs big endian in the macros... again... but this time correct
[RRG-proxmark3.git] / client / src / emv / emvjson.h
blobe90aa42d8eed94861c802397c6edee80cae74961
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2018 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 // EMV json logic
9 //-----------------------------------------------------------------------------
10 #ifndef EMVJSON_H__
11 #define EMVJSON_H__
13 #include "common.h"
15 #include "jansson.h"
16 #include "jansson_path.h"
17 #include "tlv.h"
19 typedef struct {
20 tlv_tag_t Tag;
21 const char *Name;
22 } ApplicationDataElm;
24 const char *GetApplicationDataName(tlv_tag_t tag);
26 int JsonSaveJsonObject(json_t *root, const char *path, json_t *value);
27 int JsonSaveStr(json_t *root, const char *path, const char *value);
28 int JsonSaveBoolean(json_t *root, const char *path, bool value);
29 int JsonSaveInt(json_t *root, const char *path, int value);
30 int JsonSaveBufAsHexCompact(json_t *elm, const char *path, uint8_t *data, size_t datalen);
31 int JsonSaveBufAsHex(json_t *elm, const char *path, uint8_t *data, size_t datalen);
32 int JsonSaveHex(json_t *elm, const char *path, uint64_t data, int datalen);
34 int JsonSaveTLVValue(json_t *root, const char *path, struct tlvdb *tlvdbelm);
35 int JsonSaveTLVElm(json_t *elm, const char *path, struct tlv *tlvelm, bool saveName, bool saveValue, bool saveAppDataLink);
36 int JsonSaveTLVTreeElm(json_t *elm, const char *path, struct tlvdb *tlvdbelm, bool saveName, bool saveValue, bool saveAppDataLink);
38 int JsonSaveTLVTree(json_t *root, json_t *elm, const char *path, struct tlvdb *tlvdbelm);
40 int JsonLoadStr(json_t *root, const char *path, char *value);
41 int JsonLoadBufAsHex(json_t *elm, const char *path, uint8_t *data, size_t maxbufferlen, size_t *datalen);
43 bool ParamLoadFromJson(struct tlvdb *tlv);
45 #endif