-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlsproto.h
69 lines (50 loc) · 1.36 KB
/
lsproto.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
#ifndef __lsproto_h__
#define __lsproto_h__
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include "msvcint.h"
#include "sproto.h"
#ifdef __cplusplus
extern "C" {
#endif
struct encode_ud{
struct sproto_type *st;
int tbl_index;
const char * array_tag;
struct cJSON * json_item;
int array_index;
int deep;
int iter_index;
};
struct decode_ud{
const char * array_tag;
int array_index;
int result_index;
int deep;
int mainindex_tag;
int key_index;
struct cJSON* json_item;
};
struct protocol_ret{
int tag;
struct sproto_type *request;
struct sproto_type *response;
};
struct sproto * lnewproto(const char * buffer, size_t sz);
int ldeleteproto(struct sproto * sp) ;
struct sproto_type * lquerytype(struct sproto *sp, const char * type_name);
int encode(const struct sproto_arg *args);
void * expand_buffer(void* p, int osz, int nsz);
int lencode(struct sproto * sp,struct sproto_type * st, char* jsonStr, char** ppBuffer, size_t sz);
int decode(const struct sproto_arg *args);
void ldumpproto(struct sproto * sp);
char* lpack(const void * buffer, size_t sz, size_t* pOutSize);
char* lunpack(const void * buffer, size_t sz, size_t* pOutSize);
int lprotocol(struct sproto * sp, const char* name, struct protocol_ret * pRet);
int lsaveproto(struct sproto * sp, int index);
struct sproto * lloadproto(int index);
#ifdef __cplusplus
}
#endif
#endif