]> cvs.zerfleddert.de Git - proxmark3-svn/blob - armsrc/tlv.h
FIX: corrected the FLAG_NR_AR_ATTACK
[proxmark3-svn] / armsrc / tlv.h
1 #ifndef __TLV_H
2 #define __TLV_H
3
4 #include <stdint.h>
5 #include <stdio.h>
6 #include <string.h>
7 #include <stdint.h>
8
9 //structure buffer definitions
10 #define TAG_LENGTH 2
11 #define VALUE_LENGTH 1024
12
13 //masks
14 //if TLV_TAG_NUMBER_MASK bits are set, refer to the next byte for the tag number
15 //otherwise its located in bits 1-5
16 #define TLV_TAG_NUMBER_MASK 0x1f
17 //if TLV_DATA_MASK set then its a 'constructed data object'
18 //otherwise a 'primitive data object'
19 #define TLV_DATA_MASK 0x20
20 #define TLV_TAG_MASK 0x80
21 #define TLV_LENGTH_MASK 0x80
22
23 //tlv tag structure, tag can be max of 2 bytes, length up to 65535 and value 1024 bytes long
24 typedef struct {
25 uint8_t tag[TAG_LENGTH];
26 uint16_t fieldlength;
27 uint16_t valuelength;
28 uint8_t value[VALUE_LENGTH];
29 }tlvtag;
30
31 //decode a BER TLV
32 extern int decode_ber_tlv_item(uint8_t* data, tlvtag* returnedtag);
33 extern int encode_ber_tlv_item(uint8_t* tag, uint8_t taglen, uint8_t*data, uint32_t datalen, uint8_t* outputtag, uint32_t* outputtaglen);
34 #endif //__TLV_H
Impressum, Datenschutz