opcua dissector: fix display of service type in packet column

The loop was iterating using g_NumServices, which is the number of entries in g_arParserTable and not the number of entries in g_requesttypes. Instead now we use val_to_str which can in addition display the ServiceId instead if not found in the table.

Change-Id: If15ee5c460e07c4687464805935b92c913392011
Reviewed-on: https://code.wireshark.org/review/9459
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Hannes Mezger 2015-07-02 11:48:12 +02:00 committed by Michael Mann
parent 4eca268935
commit e0deadcbc7
1 changed files with 8 additions and 15 deletions

View File

@ -332,22 +332,15 @@ static int dissect_opcua_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
/* display the service type in addition to the message type */
if (iServiceId != -1)
{
int indx = 0;
while (indx < g_NumServices)
const gchar *szServiceName = val_to_str((guint32)iServiceId, g_requesttypes, "ServiceId %d");
if (bIsLastFragment == FALSE)
{
if (g_requesttypes[indx].value == (guint32)iServiceId)
{
if (bIsLastFragment == FALSE)
{
col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", g_szMessageTypes[msgtype], g_requesttypes[indx].strptr);
}
else
{
col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s (Message Reassembled)", g_szMessageTypes[msgtype], g_requesttypes[indx].strptr);
}
break;
}
indx++;
col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s", g_szMessageTypes[msgtype], szServiceName);
}
else
{
col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %s (Message Reassembled)", g_szMessageTypes[msgtype], szServiceName);
}
}
}