-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtesttlv.c
51 lines (42 loc) · 1009 Bytes
/
testtlv.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include "tlvparse.h"
int main()
{
unsigned char buf2[] = {
0x6F,0x22,0x84,0x0E,0x31,0x50,0x41,0x59,0x2E,0x53,0x59,0x53,
0x2E,0x44,0x44,0x46,0x30,0x31,0xA5,0x10,0x88,0x01,0x01,0x5F,
0x2D,0x02,0x7A,0x68,0xBF,0x0C,0x05,0x9F,0x4D,0x02,0x0B,0x0A
};
unsigned char buf3[] = {
0x70,0x1C,0x61,0x1A,0x4F,0x08,0xA0,0x00,0x00,0x03,0x33,0x01,
0x01,0x02,0x50,0x0B,0x50,0x42,0x4F,0x43,0x20,0x43,0x52,0x45,
0x44,0x49,0x54,0x87,0x01,0x01
};
//parse 1
struct TLVNode* node = TLV_Parse(buf2,sizeof(buf2));
TLV_Debug(node);
//parse 2
struct TLVNode* node2 = TLV_Parse(buf3,sizeof(buf3));
TLV_Debug(node2);
TLV_Merge(node,node2);
TLV_Free(node2);
struct TLVNode* found = TLV_Find(node,0x9f4d);
if(found)
{
printf("FOUND! 9f4d\n");
}
else
{
printf("NOT FOUND! 9f4d\n");
}
found = TLV_Find(node,0x4f);
if(found)
{
printf("FOUND! 4f\n");
}
else
{
printf("NOT FOUND! 4f\n");
}
return 0;
}