AceT_Decoder_Decode_Proc
Abstract
Callback: Used to generate summary lines.
Syntax
<decode_proc> (state_ptr, pk_ptr, protocol, layer, offset, next_protocol_offset, next_protocol_id)
| Argument | Type | Description |
|---|---|---|
state_ptr |
void * |
State information. |
pk_ptr |
AceT_Packet * |
Packet of interest. |
protocol |
int |
ID of the protocol to be decoded. |
layer |
int |
Layer of protocol (used by enhanced decoders) |
offset |
int |
Offset in packet at which the previous protocol ended. |
next_protocol_offset |
int * |
Area to hold the offset at which the decoded protocol ended (offset plus length of protocol header). |
next_protocol_id |
int * |
Area to hold the ID of the next protocol. Set this to ACEC_DECODER_PROTOCOL_UNKNOWN if protocol is the highest protocol for the packet. |
Return Type
AceT_Decode_Status
Completion status of the decode operation (one of the values shown in Table 4 Callback Symbolic Constants).
Header
ace_client_api.h
Example
AceT_Decode_Status
op_xyz_decoder_decode (void * state_ptr, AceT_Packet * pk_ptr, int protocol,
int layer, int offset, int * next_protocol_offset, int * next_protocol_id)
{
AceT_Decode_Status retval = AceC_Decode_OK;
AceT_Pk_Protocol_Info * info_ptr;
static unsigned char * rec_data = PRGC_NIL;
static int rec_data_arr_size = 0;
int rec_data_size;
AceT_Import_Handle * import_ptr = (AceT_Import_Handle *) state_ptr;
char decode_info_str [128];
FIN (op_xyz_decoder_decode);
/* Obtain the data from the file. Because this function might be called */
/* a lot, we want to reuse the array allocated of recorded data, that's why */
/* it is static. We also want to keep track of the size of the array, */
/* in case a bigger one must be allocated. */
rec_data_size = Ace_Packet_Raw_Binary_Get (pk_ptr, 0, &rec_data,
rec_data_arr_size);
if (rec_data_size > rec_data_arr_size)
rec_data_arr_size = rec_data_size;
/* Make sure we have enough data to decode XYZ */
if ((rec_data_size - 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);
}
info_ptr = Ace_Packet_Protocol_Info_Append (pk_ptr, "XYZ", offset);
[Logic to parse the binary and figure out the values of the header fields]
[Logic to fill in the summary string (decode_info_str)]
Ace_Protocol_Info_Summary_Set (info_ptr, decode_info_str);
*next_protocol_id = ACEC_DECODER_PROTOCOL_UNKNOWN;
FRET (AceC_Decode_OK);
}
Details
This callback is invoked whenever Transaction Analyzer needs a summary line for a protocol decoded by a custom decoder.