125 lines
3.0 KiB
C
125 lines
3.0 KiB
C
#ifndef _JSON_INTERFACE_H
|
|
#define _JSON_INTERFACE_H
|
|
|
|
#define INTERFACE_VERSINO (1)
|
|
|
|
#include "object_manager.h"
|
|
|
|
typedef enum {
|
|
OBJ_CMD_ADD = 100,
|
|
OBJ_CMD_DEL = 101,
|
|
OBJ_CMD_MOD = 102,
|
|
OBJ_CMD_QUERYLIST = 103,
|
|
OBJ_CMD_QUERYDETAIL = 104,
|
|
} JSON_CMD;
|
|
|
|
typedef enum {
|
|
JE_INTERFACE,
|
|
JE_OBJ_ADD,
|
|
JE_OBJ_DEL,
|
|
JE_OBJ_MOD,
|
|
JE_OBJ_QUERYLIST,
|
|
JE_OBJ_QUERYDETAIL,
|
|
JE_OBJ_SEARCH,
|
|
|
|
JSON_ENGINE_MAX,
|
|
} JSON_ENGINE_TYPE;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct {
|
|
int cmdId;
|
|
int ver;
|
|
int cryptoType;
|
|
int timeStamp;
|
|
const char *msgContent;
|
|
} JSON_INTERFACE, *PJSON_INTERFACE;
|
|
|
|
typedef struct {
|
|
PCMHI_OBJECT pObj;
|
|
OBJECT_K objk;
|
|
} IFC_ADD_CTX, *PIFC_ADD_CTX;
|
|
|
|
typedef struct {
|
|
PIFC_ADD_CTX pCtx;
|
|
int n_obj;
|
|
} IFACE_ADD_OBJ, *PIFACE_ADD_OBJ;
|
|
|
|
typedef struct {
|
|
char name[100][MAX_NAME_LEN];
|
|
int n_obj;
|
|
} IFACE_DEL_OBJ, IFACE_DETAIL_OBJ, *PIFACE_DETAIL_OBJ, *PIFACE_DEL_OBJ;
|
|
|
|
typedef struct {
|
|
char session[MAX_SESSION];
|
|
int type;
|
|
int start;
|
|
int end;
|
|
} IFACE_QUERY_LIST, IFACE_SEARCH_LIST, *PIFACE_QUERY_LIST, *PIFACE_SEARCH_LIST;
|
|
|
|
typedef struct {
|
|
char key[MAX_REGEX_LEN];
|
|
int type;
|
|
int regex;
|
|
int maxItems;
|
|
} IFACE_SEARCH_OBJ, *PIFACE_SEARCH_OBJ;
|
|
|
|
typedef struct {
|
|
char *name;
|
|
char *mesg;
|
|
int ret_code;
|
|
} IFC_RET_LIST, *PIFC_RET_LIST;
|
|
|
|
typedef struct {
|
|
int ret_code;
|
|
char *mesg;
|
|
int n_items;
|
|
IFC_RET_LIST data[MAX_PAGE_ITEMS];
|
|
} IFC_RET_MSG, *PIFC_RET_MSG;
|
|
|
|
typedef struct {
|
|
char name[MAX_NAME_LEN];
|
|
char *mesg;
|
|
char* desc[MAX_DESC];
|
|
int prio;
|
|
int ret_code;
|
|
POBJECT_K pObjK;
|
|
} IFC_RET_DETAIL_LIST, *PIFC_RET_DETAIL_LIST;
|
|
|
|
typedef struct {
|
|
int ret_code;
|
|
char *mesg;
|
|
int n_items;
|
|
IFC_RET_DETAIL_LIST data[MAX_PAGE_ITEMS];
|
|
} IFC_RET_DETAIL_MSG, *PIFC_RET_DETAIL_MSG;
|
|
|
|
typedef struct {
|
|
char *name;
|
|
char *desc;
|
|
int type;
|
|
int ref_count;
|
|
} IFC_RET_PAGE_LIST, *PIFC_RET_PAGE_LIST;
|
|
|
|
typedef struct {
|
|
int ret_code;
|
|
char *mesg;
|
|
char *session;
|
|
int type;
|
|
int tolItems;
|
|
int start;
|
|
int end;
|
|
int n_items;
|
|
IFC_RET_PAGE_LIST data[MAX_PAGE_ITEMS];
|
|
} IFC_RET_PAGE_MSG, *PIFC_RET_PAGE_MSG;
|
|
|
|
int Json2Struct(const char *pJsonStr, void *pData, JSON_ENGINE_TYPE type,
|
|
int enBase64);
|
|
const char *Struct2Json(void *pStruct, JSON_ENGINE_TYPE type, int enBase64,
|
|
int *pErr);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif |