aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/opcua/opcua_extensionobjecttable.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_extensionobjecttable.c
parentb7b98d43157fda0246befae57e18da2ee8232dc9 (diff)
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_extensionobjecttable.c')
-rw-r--r--plugins/opcua/opcua_extensionobjecttable.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/plugins/opcua/opcua_extensionobjecttable.c b/plugins/opcua/opcua_extensionobjecttable.c
new file mode 100644
index 0000000000..0d0adebc04
--- /dev/null
+++ b/plugins/opcua/opcua_extensionobjecttable.c
@@ -0,0 +1,86 @@
+/******************************************************************************
+** $Id$
+**
+** Copyright (C) 2006-2009 ascolab GmbH. All Rights Reserved.
+** Web: http://www.ascolab.com
+**
+** This program is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License
+** as published by the Free Software Foundation; either version 2
+** of the License, or (at your option) any later version.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+** Project: OpcUa Wireshark Plugin
+**
+** Description: Service table and service dispatcher.
+**
+** This file was autogenerated on 31.03.2009.
+** DON'T MODIFY THIS FILE!
+** XXX - well, except that you may have to. See the README.
+**
+******************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <glib.h>
+#include <epan/packet.h>
+#include "opcua_simpletypes.h"
+#include "opcua_complextypeparser.h"
+#include "opcua_extensionobjectids.h"
+#include "opcua_hfindeces.h"
+
+ExtensionObjectParserEntry g_arExtensionObjectParserTable[] = {
+ { OpcUaId_DataChangeNotification_Encoding_DefaultBinary, parseDataChangeNotification, "DataChangeNotification" },
+ { OpcUaId_EventNotificationList_Encoding_DefaultBinary, parseEventNotificationList, "EventNotificationList" },
+};
+const int g_NumTypes = sizeof(g_arExtensionObjectParserTable) / sizeof(ExtensionObjectParserEntry);
+
+/** Dispatch all extension objects to a special parser function. */
+void dispatchExtensionObjectType(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int TypeId)
+{
+ gint iOffset = *pOffset;
+ int index = 0;
+ int bFound = 0;
+ gint32 iLen = 0;
+
+ /* get the length of the body */
+ iLen = tvb_get_letohl(tvb, iOffset);
+ iOffset += 4;
+
+ while (index < g_NumTypes)
+ {
+ if (g_arExtensionObjectParserTable[index].iRequestId == TypeId)
+ {
+ bFound = 1;
+ (*g_arExtensionObjectParserTable[index].pParser)(tree, tvb, &iOffset, g_arExtensionObjectParserTable[index].typeName);
+ break;
+ }
+ index++;
+ }
+
+ /* display contained object as ByteString if unknown type */
+ if (bFound == 0)
+ {
+ if (iLen == -1)
+ {
+ proto_tree_add_text(tree, tvb, iOffset, 0, "[OpcUa Null ByteString]");
+ }
+ else if (iLen >= 0)
+ {
+ proto_tree_add_item(tree, hf_opcua_ByteString, tvb, iOffset, iLen, TRUE);
+ iOffset += iLen; /* eat the whole bytestring */
+ }
+ else
+ {
+ char *szValue = ep_strdup_printf("[Invalid ByteString] Invalid length: %d", iLen);
+ proto_tree_add_text(tree, tvb, iOffset, 0, "%s", szValue);
+ }
+ }
+
+ *pOffset = iOffset;
+}
+