summaryrefslogtreecommitdiff
path: root/plugins/opcua/opcua_simpletypes.c
diff options
context:
space:
mode:
authorJeff Morriss <jeff.morriss@ulticom.com>2010-11-16 17:00:50 +0000
committerJeff Morriss <jeff.morriss@ulticom.com>2010-11-16 17:00:50 +0000
commit3c7ac068863e7f82b306425a8df12263a0d00caa (patch)
treee80c899112dd88a81be97c92d82536d33bceed5c /plugins/opcua/opcua_simpletypes.c
parentb7b98d43157fda0246befae57e18da2ee8232dc9 (diff)
downloadwireshark-3c7ac068863e7f82b306425a8df12263a0d00caa.tar.gz
From Gerhard Gappmeier via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5410 :
This patch adds support for displaying OPC UA ExtensionObjects. An ExtensionObject is a mechanism to transport user defined structures as serialized blobs. Some types of ExtensionObjects are already defined by the OPC Foundation's OPC UA Specifications. These types can be implemented by this dissector, because they are well-known. Real user-defined or vendor-defined types are unlikely to be implemented by a passive dissector, because this would require browsing of the UA server's address space to retrieve the type information. Currently only the following types are supported: * DataChangeNotification * EventNotification Others OPC defined types will follow. From me: fix warnings: "format not a string literal and no format arguments" svn path=/trunk/; revision=34906
Diffstat (limited to 'plugins/opcua/opcua_simpletypes.c')
-rw-r--r--plugins/opcua/opcua_simpletypes.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/plugins/opcua/opcua_simpletypes.c b/plugins/opcua/opcua_simpletypes.c
index 6297d1890b..31a17876cb 100644
--- a/plugins/opcua/opcua_simpletypes.c
+++ b/plugins/opcua/opcua_simpletypes.c
@@ -31,6 +31,7 @@
#include <epan/dissectors/packet-windows-common.h>
#include "opcua_simpletypes.h"
#include "opcua_hfindeces.h"
+#include "opcua_extensionobjectids.h"
#include <epan/emem.h>
#define DIAGNOSTICINFO_ENCODINGMASK_SYMBOLICID_FLAG 0x01
@@ -55,6 +56,8 @@
/* Chosen arbitrarily */
#define MAX_ARRAY_LEN 10000
+void dispatchExtensionObjectType(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int TypeId);
+
static int hf_opcua_diag_mask_symbolicflag = -1;
static int hf_opcua_diag_mask_namespaceflag = -1;
static int hf_opcua_diag_mask_localizedtextflag = -1;
@@ -824,6 +827,7 @@ void parseExtensionObject(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, char *
{
gint iOffset = *pOffset;
guint8 EncodingMask;
+ guint32 TypeId;
proto_tree *extobj_tree;
proto_tree *mask_tree;
proto_item *ti;
@@ -833,6 +837,7 @@ void parseExtensionObject(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, char *
extobj_tree = proto_item_add_subtree(ti, ett_opcua_extensionobject);
/* add nodeid subtree */
+ TypeId = getExtensionObjectType(tvb, &iOffset);
parseExpandedNodeId(extobj_tree, tvb, &iOffset, "TypeId");
/* parse encoding mask */
@@ -845,7 +850,7 @@ void parseExtensionObject(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, char *
if (EncodingMask & EXTOBJ_ENCODINGMASK_BINBODY_FLAG) /* has binary body ? */
{
- parseByteString(extobj_tree, tvb, &iOffset, hf_opcua_ByteString);
+ dispatchExtensionObjectType(extobj_tree, tvb, &iOffset, TypeId);
}
*pOffset = iOffset;
@@ -908,3 +913,37 @@ void parseExpandedNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, char *s
*pOffset = iOffset;
}
+
+guint32 getExtensionObjectType(tvbuff_t *tvb, gint *pOffset)
+{
+ gint iOffset = *pOffset;
+ guint8 EncodingMask;
+ guint32 Numeric = 0;
+
+ EncodingMask = tvb_get_guint8(tvb, iOffset);
+ iOffset++;
+
+ switch(EncodingMask)
+ {
+ case 0x00: /* two byte node id */
+ Numeric = tvb_get_guint8(tvb, iOffset);
+ iOffset+=1;
+ break;
+ case 0x01: /* four byte node id */
+ iOffset+=1;
+ Numeric = tvb_get_letohs(tvb, iOffset);
+ break;
+ case 0x02: /* numeric, that does not fit into four bytes */
+ iOffset+=4;
+ Numeric = tvb_get_letohl(tvb, iOffset);
+ break;
+ case 0x03: /* string */
+ case 0x04: /* uri */
+ case 0x05: /* guid */
+ case 0x06: /* byte string */
+ /* NOT USED */
+ break;
+ };
+
+ return Numeric;
+}