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_encode(CEXTSRV *cextsrv, UINT8 *out_buff, const UINT32 out_buff_max_len, UINT32 *out_buff_len, TASK_FUNC *task_rsp_func) { UINT32 send_comm; FUNC_ADDR_NODE *func_addr_node; TYPE_CONV_ITEM *type_conv_item; UINT32 position; send_comm = CMPI_ANY_COMM; position = 0; if(0 != dbg_fetch_func_addr_node_by_index(task_rsp_func->func_id, &func_addr_node)) { dbg_log(SEC_0069_CEXTSRV, 0)(LOGSTDOUT, "error:cextsrv_rsp_encode: failed to fetch func addr node by func id %lx\n", task_rsp_func->func_id); return (EC_FALSE); } if(e_dbg_void != func_addr_node->func_ret_type) { 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_encode: 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_ENCODE_FUNC(type_conv_item), send_comm, task_rsp_func->func_ret_val, out_buff, out_buff_max_len, &(position)); if(EC_TRUE == TYPE_CONV_ITEM_VAR_POINTER_FLAG(type_conv_item) && 0 != task_rsp_func->func_ret_val) { dbg_tiny_caller(2, TYPE_CONV_ITEM_VAR_CLEAN_FUNC(type_conv_item), CMPI_ANY_MODI, task_rsp_func->func_ret_val);/*WARNING: SHOULD NOT BE 0*/ free_static_mem(MD_TASK, CMPI_ANY_MODI, TYPE_CONV_ITEM_VAR_MM_TYPE(type_conv_item), (void *)task_rsp_func->func_ret_val, LOC_CEXTSRV_0009);/*clean up*/ task_rsp_func->func_ret_val = 0; } } task_rsp_func_para_encode(send_comm, task_rsp_func->func_para_num, (FUNC_PARA *)task_rsp_func->func_para, func_addr_node, out_buff, out_buff_max_len, &(position)); (*out_buff_len) = position;/*set to real length*/ return (EC_TRUE); }