refact
This commit is contained in:
parent
6420811c8a
commit
6b6f3f75af
|
@ -58,6 +58,7 @@ extern int tMsgDict[];
|
|||
typedef uint16_t tmsg_t;
|
||||
|
||||
/* ------------------------ ENCODE/DECODE FUNCTIONS AND MACROS ------------------------ */
|
||||
#if 0
|
||||
struct SMEListNode {
|
||||
TD_SLIST_NODE(SMEListNode);
|
||||
SEncoder coder;
|
||||
|
@ -96,6 +97,7 @@ typedef struct SMsgDecoder {
|
|||
|
||||
void tmsgInitMsgDecoder(SMsgDecoder* pMD, td_endian_t endian, uint8_t* data, int64_t size);
|
||||
void tmsgClearMsgDecoder(SMsgDecoder* pMD);
|
||||
#endif
|
||||
|
||||
/* ------------------------ OTHER DEFINITIONS ------------------------ */
|
||||
// IE type
|
||||
|
@ -1283,8 +1285,8 @@ typedef struct {
|
|||
SArray* pArray;
|
||||
} SVCreateTbBatchReq;
|
||||
|
||||
int tmsgSVCreateTbReqEncode(SMsgEncoder* pCoder, SVCreateTbReq* pReq);
|
||||
int tmsgSVCreateTbReqDecode(SMsgDecoder* pCoder, SVCreateTbReq* pReq);
|
||||
// int tmsgSVCreateTbReqEncode(SMsgEncoder* pCoder, SVCreateTbReq* pReq);
|
||||
// int tmsgSVCreateTbReqDecode(SMsgDecoder* pCoder, SVCreateTbReq* pReq);
|
||||
int tSerializeSVCreateTbReq(void** buf, SVCreateTbReq* pReq);
|
||||
void* tDeserializeSVCreateTbReq(void* buf, SVCreateTbReq* pReq);
|
||||
int tSVCreateTbBatchReqSerialize(void** buf, SVCreateTbBatchReq* pReq);
|
||||
|
|
|
@ -74,52 +74,52 @@ typedef struct {
|
|||
#define TD_CODER_POS(CODER) ((CODER)->pos)
|
||||
#define TD_CODER_CURRENT(CODER) ((CODER)->data + (CODER)->pos)
|
||||
#define TD_CODER_MOVE_POS(CODER, MOVE) ((CODER)->pos += (MOVE))
|
||||
#define TD_CHECK_CODER_CAPACITY_FAILED(CODER, EXPSIZE) (((CODER)->size - (CODER)->pos) < (EXPSIZE))
|
||||
#define TD_CODER_CHECK_CAPACITY_FAILED(CODER, EXPSIZE) (((CODER)->size - (CODER)->pos) < (EXPSIZE))
|
||||
|
||||
void tCoderInit(SCoder* pCoder, td_endian_t endian, uint8_t* data, int32_t size, td_coder_t type);
|
||||
void tCoderClear(SCoder* pCoder);
|
||||
|
||||
/* ------------------------ ENCODE ------------------------ */
|
||||
int tStartEncode(SCoder* pEncoder);
|
||||
void tEndEncode(SCoder* pEncoder);
|
||||
int tEncodeU8(SCoder* pEncoder, uint8_t val);
|
||||
int tEncodeI8(SCoder* pEncoder, int8_t val);
|
||||
int tEncodeU16(SCoder* pEncoder, uint16_t val);
|
||||
int tEncodeI16(SCoder* pEncoder, int16_t val);
|
||||
int tEncodeU32(SCoder* pEncoder, uint32_t val);
|
||||
int tEncodeI32(SCoder* pEncoder, int32_t val);
|
||||
int tEncodeU64(SCoder* pEncoder, uint64_t val);
|
||||
int tEncodeI64(SCoder* pEncoder, int64_t val);
|
||||
int tEncodeU16v(SCoder* pEncoder, uint16_t val);
|
||||
int tEncodeI16v(SCoder* pEncoder, int16_t val);
|
||||
int tEncodeU32v(SCoder* pEncoder, uint32_t val);
|
||||
int tEncodeI32v(SCoder* pEncoder, int32_t val);
|
||||
int tEncodeU64v(SCoder* pEncoder, uint64_t val);
|
||||
int tEncodeI64v(SCoder* pEncoder, int64_t val);
|
||||
int tEncodeFloat(SCoder* pEncoder, float val);
|
||||
int tEncodeDouble(SCoder* pEncoder, double val);
|
||||
int tEncodeCStr(SCoder* pEncoder, const char* val);
|
||||
static int tStartEncode(SCoder* pEncoder);
|
||||
static void tEndEncode(SCoder* pEncoder);
|
||||
static int tEncodeU8(SCoder* pEncoder, uint8_t val);
|
||||
static int tEncodeI8(SCoder* pEncoder, int8_t val);
|
||||
static int tEncodeU16(SCoder* pEncoder, uint16_t val);
|
||||
static int tEncodeI16(SCoder* pEncoder, int16_t val);
|
||||
static int tEncodeU32(SCoder* pEncoder, uint32_t val);
|
||||
static int tEncodeI32(SCoder* pEncoder, int32_t val);
|
||||
static int tEncodeU64(SCoder* pEncoder, uint64_t val);
|
||||
static int tEncodeI64(SCoder* pEncoder, int64_t val);
|
||||
static int tEncodeU16v(SCoder* pEncoder, uint16_t val);
|
||||
static int tEncodeI16v(SCoder* pEncoder, int16_t val);
|
||||
static int tEncodeU32v(SCoder* pEncoder, uint32_t val);
|
||||
static int tEncodeI32v(SCoder* pEncoder, int32_t val);
|
||||
static int tEncodeU64v(SCoder* pEncoder, uint64_t val);
|
||||
static int tEncodeI64v(SCoder* pEncoder, int64_t val);
|
||||
static int tEncodeFloat(SCoder* pEncoder, float val);
|
||||
static int tEncodeDouble(SCoder* pEncoder, double val);
|
||||
static int tEncodeCStr(SCoder* pEncoder, const char* val);
|
||||
|
||||
/* ------------------------ DECODE ------------------------ */
|
||||
int tStartDecode(SCoder* pDecoder);
|
||||
void tEndDecode(SCoder* pDecoder);
|
||||
int tDecodeU8(SCoder* pDecoder, uint8_t* val);
|
||||
int tDecodeI8(SCoder* pDecoder, int8_t* val);
|
||||
int tDecodeU16(SCoder* pDecoder, uint16_t* val);
|
||||
int tDecodeI16(SCoder* pDecoder, int16_t* val);
|
||||
int tDecodeU32(SCoder* pDecoder, uint32_t* val);
|
||||
int tDecodeI32(SCoder* pDecoder, int32_t* val);
|
||||
int tDecodeU64(SCoder* pDecoder, uint64_t* val);
|
||||
int tDecodeI64(SCoder* pDecoder, int64_t* val);
|
||||
int tDecodeU16v(SCoder* pDecoder, uint16_t* val);
|
||||
int tDecodeI16v(SCoder* pDecoder, int16_t* val);
|
||||
int tDecodeU32v(SCoder* pDecoder, uint32_t* val);
|
||||
int tDecodeI32v(SCoder* pDecoder, int32_t* val);
|
||||
int tDecodeU64v(SCoder* pDecoder, uint64_t* val);
|
||||
int tDecodeI64v(SCoder* pDecoder, int64_t* val);
|
||||
int tDecodeFloat(SCoder* pDecoder, float* val);
|
||||
int tDecodeDouble(SCoder* pDecoder, double* val);
|
||||
int tDecodeCStr(SCoder* pEncoder, const char** val);
|
||||
static int tStartDecode(SCoder* pDecoder);
|
||||
static void tEndDecode(SCoder* pDecoder);
|
||||
static int tDecodeU8(SCoder* pDecoder, uint8_t* val);
|
||||
static int tDecodeI8(SCoder* pDecoder, int8_t* val);
|
||||
static int tDecodeU16(SCoder* pDecoder, uint16_t* val);
|
||||
static int tDecodeI16(SCoder* pDecoder, int16_t* val);
|
||||
static int tDecodeU32(SCoder* pDecoder, uint32_t* val);
|
||||
static int tDecodeI32(SCoder* pDecoder, int32_t* val);
|
||||
static int tDecodeU64(SCoder* pDecoder, uint64_t* val);
|
||||
static int tDecodeI64(SCoder* pDecoder, int64_t* val);
|
||||
static int tDecodeU16v(SCoder* pDecoder, uint16_t* val);
|
||||
static int tDecodeI16v(SCoder* pDecoder, int16_t* val);
|
||||
static int tDecodeU32v(SCoder* pDecoder, uint32_t* val);
|
||||
static int tDecodeI32v(SCoder* pDecoder, int32_t* val);
|
||||
static int tDecodeU64v(SCoder* pDecoder, uint64_t* val);
|
||||
static int tDecodeI64v(SCoder* pDecoder, int64_t* val);
|
||||
static int tDecodeFloat(SCoder* pDecoder, float* val);
|
||||
static int tDecodeDouble(SCoder* pDecoder, double* val);
|
||||
static int tDecodeCStr(SCoder* pEncoder, const char** val);
|
||||
|
||||
/* ------------------------ IMPL ------------------------ */
|
||||
#define TD_ENCODE_MACRO(CODER, VAL, TYPE, BITS) \
|
||||
|
|
|
@ -11,4 +11,6 @@ target_link_libraries(
|
|||
PRIVATE os util common transport parser planner catalog scheduler function qcom
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(test)
|
||||
if(${BUILD_TEST})
|
||||
ADD_SUBDIRECTORY(test)
|
||||
endif(${BUILD_TEST})
|
|
@ -12,4 +12,6 @@ target_link_libraries(
|
|||
INTERFACE api
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(test)
|
||||
if(${BUILD_TEST})
|
||||
ADD_SUBDIRECTORY(test)
|
||||
endif(${BUILD_TEST})
|
||||
|
|
|
@ -27,12 +27,15 @@
|
|||
#undef TD_MSG_SEG_CODE_
|
||||
#include "tmsgdef.h"
|
||||
|
||||
#if 0
|
||||
static int tmsgStartEncode(SMsgEncoder *pME);
|
||||
static void tmsgEndEncode(SMsgEncoder *pME);
|
||||
static int tmsgStartDecode(SMsgDecoder *pMD);
|
||||
static void tmsgEndDecode(SMsgDecoder *pMD);
|
||||
#endif
|
||||
|
||||
/* ------------------------ ENCODE/DECODE FUNCTIONS ------------------------ */
|
||||
#if 0
|
||||
void tmsgInitMsgEncoder(SMsgEncoder *pME, td_endian_t endian, uint8_t *data, int64_t size) {
|
||||
tInitEncoder(&(pME->coder), endian, data, size);
|
||||
TD_SLIST_INIT(&(pME->eStack));
|
||||
|
@ -74,8 +77,10 @@ void tmsgClearMsgDecoder(SMsgDecoder *pMD) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ------------------------ MESSAGE ENCODE/DECODE ------------------------ */
|
||||
#if 0
|
||||
int tmsgSVCreateTbReqEncode(SMsgEncoder *pCoder, SVCreateTbReq *pReq) {
|
||||
tmsgStartEncode(pCoder);
|
||||
// TODO
|
||||
|
@ -97,6 +102,7 @@ int tmsgSVCreateTbReqDecode(SMsgDecoder *pCoder, SVCreateTbReq *pReq) {
|
|||
tmsgEndDecode(pCoder);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
|
||||
int tlen = 0;
|
||||
|
@ -221,6 +227,7 @@ void *tSVCreateTbBatchReqDeserialize(void *buf, SVCreateTbBatchReq *pReq) {
|
|||
}
|
||||
|
||||
/* ------------------------ STATIC METHODS ------------------------ */
|
||||
#if 0
|
||||
static int tmsgStartEncode(SMsgEncoder *pME) {
|
||||
struct SMEListNode *pNode = (struct SMEListNode *)malloc(sizeof(*pNode));
|
||||
if (TD_IS_NULL(pNode)) return -1;
|
||||
|
@ -278,4 +285,5 @@ static void tmsgEndDecode(SMsgDecoder *pMD) {
|
|||
pMD->coder = pNode->coder;
|
||||
|
||||
free(pNode);
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -11,4 +11,6 @@ target_link_libraries(
|
|||
PRIVATE os util transport qcom
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(test)
|
||||
if(${BUILD_TEST})
|
||||
ADD_SUBDIRECTORY(test)
|
||||
endif(${BUILD_TEST})
|
|
@ -11,4 +11,6 @@ target_link_libraries(
|
|||
PRIVATE os util catalog function transport qcom
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(test)
|
||||
if(${BUILD_TEST})
|
||||
ADD_SUBDIRECTORY(test)
|
||||
endif(${BUILD_TEST})
|
||||
|
|
|
@ -11,4 +11,6 @@ target_link_libraries(
|
|||
PRIVATE os util catalog cjson parser transport function qcom
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(test)
|
||||
if(${BUILD_TEST})
|
||||
ADD_SUBDIRECTORY(test)
|
||||
endif(${BUILD_TEST})
|
||||
|
|
|
@ -7,8 +7,10 @@ target_include_directories(
|
|||
)
|
||||
|
||||
target_link_libraries(
|
||||
qcom
|
||||
PRIVATE os util transport
|
||||
qcom
|
||||
PRIVATE os util transport
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(test)
|
||||
if(${BUILD_TEST})
|
||||
ADD_SUBDIRECTORY(test)
|
||||
endif(${BUILD_TEST})
|
||||
|
|
|
@ -11,4 +11,6 @@ target_link_libraries(
|
|||
PRIVATE os util transport planner qcom
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(test)
|
||||
if(${BUILD_TEST})
|
||||
ADD_SUBDIRECTORY(test)
|
||||
endif(${BUILD_TEST})
|
|
@ -12,4 +12,6 @@ target_link_libraries(
|
|||
PRIVATE os util planner qcom common catalog transport
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(test)
|
||||
if(${BUILD_TEST})
|
||||
ADD_SUBDIRECTORY(test)
|
||||
endif(${BUILD_TEST})
|
|
@ -14,4 +14,7 @@ target_link_libraries(
|
|||
PUBLIC api
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY(test)
|
||||
if(${BUILD_TEST})
|
||||
ADD_SUBDIRECTORY(test)
|
||||
endif(${BUILD_TEST})
|
||||
|
||||
|
|
Loading…
Reference in New Issue