summaryrefslogtreecommitdiff
path: root/plugins/opcua/opcua_simpletypes.c
diff options
context:
space:
mode:
authorHannes Mezger <hannes.mezger@ascolab.com>2014-06-10 13:36:06 +0200
committerEvan Huus <eapache@gmail.com>2014-06-16 15:44:35 +0000
commita9b18eff0fe904c87c38262148b39718f6e3cea5 (patch)
tree6434d6b7b27e440889b2ca91f509ef9fa18dbc44 /plugins/opcua/opcua_simpletypes.c
parent39d7c9df0a8b0d520f19668cb073dcab4d2bf04e (diff)
downloadwireshark-a9b18eff0fe904c87c38262148b39718f6e3cea5.tar.gz
Display text representation of status codes
Adds a table containing all known StatusCodes and displays them if found. The list of StatusCodes is in a separate file for easy generating of the list if necessary. Change-Id: Iab74b22b7fc4fb53d8f072c4e3a4cea4ae18196c Reviewed-on: https://code.wireshark.org/review/2126 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'plugins/opcua/opcua_simpletypes.c')
-rw-r--r--plugins/opcua/opcua_simpletypes.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/opcua/opcua_simpletypes.c b/plugins/opcua/opcua_simpletypes.c
index 39f8d526ce..0f105de774 100644
--- a/plugins/opcua/opcua_simpletypes.c
+++ b/plugins/opcua/opcua_simpletypes.c
@@ -28,6 +28,7 @@
#include "opcua_simpletypes.h"
#include "opcua_hfindeces.h"
#include "opcua_extensionobjectids.h"
+#include "opcua_statuscode.h"
#include <epan/wmem/wmem.h>
#define DIAGNOSTICINFO_ENCODINGMASK_SYMBOLICID_FLAG 0x01
@@ -399,7 +400,16 @@ void parseString(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
void parseStatusCode(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN);
+ proto_item *item = NULL;
+ guint32 uStatusCode = 0;
+ const gchar *szStatusCode = NULL;
+
+ item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN);
+
+ uStatusCode = tvb_get_letohl(tvb, *pOffset);
+ szStatusCode = val_to_str_const(uStatusCode & 0xFFFF0000, g_statusCodes, "Unknown Status Code");
+ proto_item_append_text(item, " [%s]", szStatusCode);
+
*pOffset += 4;
}