AceT_Decoder_Details_Proc
摘要
回调:用于生成明细行。
语法
<details_proc> (state_ptr, pk_ptr, layer, details_lptr)
| 参数 | 类型 | 说明 |
|---|---|---|
state_ptr |
void * |
状态信息。 |
pk_ptr |
AceT_Packet * |
目标数据包。 |
layer |
int |
正在解码的协议所在层次。 |
details_lptr |
PrgT_List * |
用于存放明细行列表的区域。 |
返回类型
AceT_Decode_Status
解码操作的完成状态(取 表 4回调符号常量 中列出的值之一)。
头文件
ace_client_api.h
示例
AceT_Decode_Status
op_xyz_decoder_details (void * state_ptr, AceT_Packet * pk_ptr, int layer,
PrgT_List * details_lptr)
{
/* PURPOSE: To add details for the given packet to the details_lptr */
/* RETURNS: Success , packet failure, fatal_error. */
AceT_Decode_Status retval = AceC_Decode_OK;
static unsigned char * rec_data = PRGC_NIL;
static int rec_data_arr_size = 0;
int rec_data_size;
AceT_Pk_Protocol_Info * info_ptr;
int protocol_offset;
AceT_Import_Handle * import_ptr = (AceT_Import_Handle *) state_ptr;
char decode_info_str [128];
FIN (op_xyz_decoder_details);
info_ptr = Ace_Packet_Protocol_Info_Get (pk_ptr, layer);
protocol_offset = Ace_Protocol_Info_Offset_Get (info_ptr);
rec_data_size = Ace_Packet_Raw_Binary_Get (pk_ptr, 0, &rec_data,
rec_data_arr_size);
if ((rec_data_size - protocol_offset) < OPC_XYZ_MIN_FRAME_LENGTH)
{
Ace_Decoder_Packet_Error_Log ("op_xyz",
Ace_Packet_Frame_Number_Get (pk_ptr),
"XYZ Custom Protocol", "Not enough data captured to decode", 0);
FRET (AceC_Decode_Packet_Error);
}
[Logic to parse the binary and figure out the values of the header fields]
[For each line in the decode details, sprintf into the decode_info_str]
prg_list_strings_append (details_lptr, decode_info_str, VOSC_NIL);
FRET (retval);
}
详情
每当 Transaction Analyzer 需要为自定义解码器解码的协议生成明细行时,都会调用该回调。它负责生成一个包含正在解码协议全部明细行的列表。