-
Notifications
You must be signed in to change notification settings - Fork 2
/
viewstate.h
96 lines (75 loc) · 1.69 KB
/
viewstate.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// viewstate.h by Daniel Ferreira
// Public domain.
typedef struct type_ vsType;
typedef enum {
kViewStateTypeUnknown,
kViewStateTypeNull,
kViewStateTypeByte,
kViewStateTypeBoolean,
kViewStateTypeInteger,
kViewStateTypeChar,
kViewStateTypeString,
kViewStateTypeIndexedString,
kViewStateTypeArray,
kViewStateTypeStringArray,
kViewStateTypeArrayList,
kViewStateTypeEnum,
kViewStateTypePair,
kViewStateTypeTriplet,
kViewStateTypeError
} vsStateType;
typedef struct {
vsType **array;
unsigned int type;
} vsTypeArray;
typedef struct {
int32_t value; // We ignore 64-bit values for now. Sorry.
unsigned int type;
} vsTypeEnumValue;
typedef struct {
vsType *first;
vsType *second;
} vsPair;
typedef struct {
vsType *first;
vsType *second;
vsType *third;
} vsTriplet;
typedef struct {
vsPair *kvPairs;
} vsDictionary;
struct type_ {
union {
unsigned char byte;
unsigned char boolean;
int32_t integer;
uint16_t character;
char *string;
char *indexedString;
vsTypeArray *array;
char **stringArray;
vsType **arrayList;
vsDictionary dictionary;
vsTypeEnumValue enumValue;
vsPair *pair;
vsTriplet *triplet;
int error;
};
vsStateType stateType;
unsigned int length;
};
#ifdef __cplusplus
extern "C" {
#endif
int base64_decode(const char *string, size_t len, char **output);
char *get_from_indexedstring_cache(int idx);
char *get_type_description(int type);
int32_t read_viewstate_int(unsigned char **viewState);
int read_type_format(unsigned char **viewState);
vsType *parse_viewstate(unsigned char **viewState, _Bool needsHeader);
void free_viewstate(vsType *type);
void init_viewstate_context();
void cleanup_viewstate_context();
#ifdef __cplusplus
}
#endif