void clist_codec_set(CLIST *clist, const UINT32 data_mm_type) { TYPE_CONV_ITEM *type_conv_item; //CLIST_LOCK(clist, LOC_CLIST_0003); clist->data_mm_type = data_mm_type; type_conv_item = dbg_query_type_conv_item_by_mm(data_mm_type); if(NULL_PTR != type_conv_item) { clist->data_encoder = (CLIST_DATA_ENCODER )TYPE_CONV_ITEM_VAR_ENCODE_FUNC(type_conv_item); clist->data_encoder_size = (CLIST_DATA_ENCODER_SIZE)TYPE_CONV_ITEM_VAR_ENCODE_SIZE(type_conv_item); clist->data_decoder = (CLIST_DATA_DECODER )TYPE_CONV_ITEM_VAR_DECODE_FUNC(type_conv_item); clist->data_init = (CLIST_DATA_INIT )TYPE_CONV_ITEM_VAR_INIT_FUNC(type_conv_item); clist->data_clean = (CLIST_DATA_CLEAN )TYPE_CONV_ITEM_VAR_CLEAN_FUNC(type_conv_item); clist->data_free = (CLIST_DATA_FREE )TYPE_CONV_ITEM_VAR_FREE_FUNC(type_conv_item); } else { clist->data_encoder = NULL_PTR; clist->data_encoder_size = NULL_PTR; clist->data_decoder = NULL_PTR; clist->data_init = NULL_PTR; clist->data_clean = NULL_PTR; clist->data_free = NULL_PTR; } //CLIST_UNLOCK(clist, LOC_CLIST_0004); return; }
EC_BOOL cextsrv_rsp_decode(CEXTSRV *cextsrv, const UINT8 *in_buff, const UINT32 in_buff_len, TASK_FUNC *task_req_func) { UINT32 recv_comm; FUNC_ADDR_NODE *func_addr_node; TYPE_CONV_ITEM *type_conv_item; UINT32 position; recv_comm = CMPI_ANY_COMM; position = 0; if(0 != dbg_fetch_func_addr_node_by_index(task_req_func->func_id, &func_addr_node)) { dbg_log(SEC_0069_CEXTSRV, 0)(LOGSTDOUT, "error:cextsrv_rsp_decode: failed to fetch func addr node by func id %lx\n", task_req_func->func_id); return (EC_FALSE); } if(e_dbg_void != func_addr_node->func_ret_type) { if(0 == task_req_func->func_ret_val) { dbg_log(SEC_0069_CEXTSRV, 0)(LOGSTDOUT, "error:cextsrv_rsp_decode: func id %lx func_ret_val should not be null\n", task_req_func->func_id); exit(0);/*coding bug, user should fix it*/ } type_conv_item = dbg_query_type_conv_item_by_type(func_addr_node->func_ret_type); if( NULL_PTR == type_conv_item ) { dbg_log(SEC_0069_CEXTSRV, 0)(LOGSTDOUT,"error:cextsrv_rsp_decode: ret type %ld conv item is not defined\n", func_addr_node->func_ret_type); return (EC_FALSE); } dbg_tiny_caller(5, TYPE_CONV_ITEM_VAR_DECODE_FUNC(type_conv_item), recv_comm, in_buff, in_buff_len, &(position), task_req_func->func_ret_val); } if(EC_FALSE == task_rsp_func_para_decode(recv_comm, in_buff, in_buff_len, &(position), task_req_func->func_para_num, (FUNC_PARA *)task_req_func->func_para, func_addr_node)) { dbg_log(SEC_0069_CEXTSRV, 0)(LOGSTDOUT, "error:cextsrv_rsp_decode: decode rsp func paras failed\n"); return (EC_FALSE); } return (EC_TRUE); }