Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

what is the best way to display the different modes of a protocol in a custom c dissector

Hi,

i'm still working on my plugin c dissector for the iolink protocol. In the specification there are several operation modes of a iolink device. I want to display the mode on the GUI.

Until now i figured this out. The variable "iolink_mode" is static. The mode/status should be displayed for everyframe. The first incoming frame gives the first mode which stays until one of the following frames has a different mode. If i dont use the static variable i just have the one frame marked, where the mode changes. I'm sure there are better solutions out there but i couldn't finde one yet. Thanks in advance

static void determine_iolink_mode(packet_info *pinfo, guint32 iolink_mode) {
switch (iolink_mode) { case 0x5A: // Fallback col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x95: // MasterIdent col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x96: // DeviceIdent col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x97: // DeviceStartUp col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x98: // ProcessDataOutputOperate col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x99: // DeviceOperate col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x9A: // Preoperate col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; } }

what is the best way to display the different modes of a protocol in a custom c dissector

Hi,

i'm still working on my plugin c dissector for the iolink protocol. In the specification there are several operation modes of a iolink device. I want to display the mode on the GUI.

Until now i figured this out. The variable "iolink_mode" is static. The mode/status should be displayed for everyframe. The first incoming frame gives the first mode which stays until one of the following frames has a different mode. If i dont use the static variable i just have the one frame marked, where the mode changes. I'm sure there are better solutions out there but i couldn't finde one yet. Thanks in advance

greetings

Robin

The code:

static void determine_iolink_mode(packet_info *pinfo, guint32 iolink_mode) {
switch (iolink_mode) { case 0x5A: // Fallback col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x95: // MasterIdent col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x96: // DeviceIdent col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x97: // DeviceStartUp col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x98: // ProcessDataOutputOperate col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x99: // DeviceOperate col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x9A: // Preoperate col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; } }

what is the best way to display the different modes of a protocol in a custom c dissector

Hi,

i'm still working on my plugin c dissector for the iolink protocol. In the specification there are several operation modes of a iolink device. I want to display the mode on the GUI.

Until now i figured this out. The variable "iolink_mode" is static. The mode/status should be displayed for everyframe. The first incoming frame gives the first mode which stays until one of the following frames has a different mode. If i dont use the static variable i just have the one frame marked, where the mode changes. I'm sure there are better solutions out there but i couldn't finde one yet. Thanks in advance

greetings

Robin

The code:

static void determine_iolink_mode(packet_info *pinfo, guint32 iolink_mode) 
{ 
switch (iolink_mode) { case 0x5A: // Fallback col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x95: // MasterIdent col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x96: // DeviceIdent col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x97: // DeviceStartUp col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x98: // ProcessDataOutputOperate col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x99: // DeviceOperate col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; case 0x9A: // Preoperate col_append_fstr(pinfo->cinfo, COL_EXPERT,"%s", val_to_str(iolink_mode, values_for_mastercommand, "Unknown (0x%02x)")); break; } }

}