1 /******************************************************************************
4 ** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved.
5 ** Web: http://www.ascolab.com
7 ** This program is free software; you can redistribute it and/or
8 ** modify it under the terms of the GNU General Public License
9 ** as published by the Free Software Foundation; either version 2
10 ** of the License, or (at your option) any later version.
12 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 ** Project: OpcUa Wireshark Plugin
17 ** Description: Implementation of OpcUa built-in type parsers.
18 ** This contains all the simple types and some complex types.
20 ** Author: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com>
21 ** Last change by: $Author: gergap $
23 ******************************************************************************/
28 #include <epan/packet.h>
29 #include <epan/dissectors/packet-windows-common.h>
30 #include "opcua_simpletypes.h"
31 #include "opcua_hfindeces.h"
32 #include "opcua_extensionobjectids.h"
33 #include <epan/emem.h>
35 #define DIAGNOSTICINFO_ENCODINGMASK_SYMBOLICID_FLAG 0x01
36 #define DIAGNOSTICINFO_ENCODINGMASK_NAMESPACE_FLAG 0x02
37 #define DIAGNOSTICINFO_ENCODINGMASK_LOCALIZEDTEXT_FLAG 0x04
38 #define DIAGNOSTICINFO_ENCODINGMASK_ADDITIONALINFO_FLAG 0x08
39 #define DIAGNOSTICINFO_ENCODINGMASK_INNERSTATUSCODE_FLAG 0x10
40 #define DIAGNOSTICINFO_ENCODINGMASK_INNERDIAGNOSTICINFO_FLAG 0x20
41 #define LOCALIZEDTEXT_ENCODINGBYTE_LOCALE 0x01
42 #define LOCALIZEDTEXT_ENCODINGBYTE_TEXT 0x02
43 #define NODEID_URIMASK 0x80
44 #define NODEID_SERVERINDEXFLAG 0x40
45 #define DATAVALUE_ENCODINGBYTE_VALUE 0x01
46 #define DATAVALUE_ENCODINGBYTE_STATUSCODE 0x02
47 #define DATAVALUE_ENCODINGBYTE_SOURCETIMESTAMP 0x04
48 #define DATAVALUE_ENCODINGBYTE_SERVERTIMESTAMP 0x08
49 #define DATAVALUE_ENCODINGBYTE_SOURCEPICOSECONDS 0x10
50 #define DATAVALUE_ENCODINGBYTE_SERVERPICOSECONDS 0x20
51 #define EXTOBJ_ENCODINGMASK_BINBODY_FLAG 0x01
52 #define EXTOBJ_ENCODINGMASK_XMLBODY_FLAG 0x02
54 /* Chosen arbitrarily */
55 #define MAX_ARRAY_LEN 10000
57 void dispatchExtensionObjectType(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int TypeId);
59 static int hf_opcua_diag_mask_symbolicflag = -1;
60 static int hf_opcua_diag_mask_namespaceflag = -1;
61 static int hf_opcua_diag_mask_localizedtextflag = -1;
62 static int hf_opcua_diag_mask_additionalinfoflag = -1;
63 static int hf_opcua_diag_mask_innerstatuscodeflag = -1;
64 static int hf_opcua_diag_mask_innerdiaginfoflag = -1;
65 static int hf_opcua_loctext_mask_localeflag = -1;
66 static int hf_opcua_loctext_mask_textflag = -1;
67 static int hf_opcua_datavalue_mask_valueflag = -1;
68 static int hf_opcua_datavalue_mask_statuscodeflag = -1;
69 static int hf_opcua_datavalue_mask_sourcetimestampflag = -1;
70 static int hf_opcua_datavalue_mask_servertimestampflag = -1;
71 static int hf_opcua_datavalue_mask_sourcepicoseconds = -1;
72 static int hf_opcua_datavalue_mask_serverpicoseconds = -1;
73 static int hf_opcua_nodeid_encodingmask = -1;
74 static int hf_opcua_variant_encodingmask = -1;
75 static int hf_opcua_nodeid_nsid = -1;
76 static int hf_opcua_nodeid_numeric = -1;
77 static int hf_opcua_localizedtext_locale = -1;
78 static int hf_opcua_localizedtext_text = -1;
79 static int hf_opcua_qualifiedname_id = -1;
80 static int hf_opcua_qualifiedname_name = -1;
81 static int hf_opcua_SourceTimestamp = -1;
82 static int hf_opcua_SourcePicoseconds = -1;
83 static int hf_opcua_ServerTimestamp = -1;
84 static int hf_opcua_ServerPicoseconds = -1;
85 static int hf_opcua_diag_symbolicid = -1;
86 static int hf_opcua_diag_namespace = -1;
87 static int hf_opcua_diag_localizedtext = -1;
88 static int hf_opcua_diag_additionalinfo = -1;
89 static int hf_opcua_diag_innerstatuscode = -1;
90 static int hf_opcua_extobj_mask_binbodyflag = -1;
91 static int hf_opcua_extobj_mask_xmlbodyflag = -1;
92 static int hf_opcua_ArraySize = -1;
93 static int hf_opcua_Uri = -1;
94 static int hf_opcua_ServerIndex = -1;
96 /** NodeId encoding mask table */
97 static const value_string g_nodeidmasks[] = {
98 { 0, "Two byte encoded Numeric" },
99 { 1, "Four byte encoded Numeric" },
100 { 2, "Numeric of arbitrary length" },
109 /** UA Variant Type enum */
110 typedef enum _OpcUa_BuiltInType
113 OpcUaType_Boolean = 1,
117 OpcUaType_UInt16 = 5,
119 OpcUaType_UInt32 = 7,
121 OpcUaType_UInt64 = 9,
122 OpcUaType_Float = 10,
123 OpcUaType_Double = 11,
124 OpcUaType_String = 12,
125 OpcUaType_DateTime = 13,
127 OpcUaType_ByteString = 15,
128 OpcUaType_XmlElement = 16,
129 OpcUaType_NodeId = 17,
130 OpcUaType_ExpandedNodeId = 18,
131 OpcUaType_StatusCode = 19,
132 OpcUaType_QualifiedName = 20,
133 OpcUaType_LocalizedText = 21,
134 OpcUaType_ExtensionObject = 22,
135 OpcUaType_DataValue = 23,
136 OpcUaType_Variant = 24,
137 OpcUaType_DiagnosticInfo = 25
141 /** Variant encoding mask table */
142 static const value_string g_VariantTypes[] = {
158 { 15, "ByteString" },
159 { 16, "XmlElement" },
161 { 18, "ExpandedNodeId" },
162 { 19, "StatusCode" },
163 { 20, "QualifiedName" },
164 { 21, "LocalizedText" },
165 { 22, "ExtensionObject" },
168 { 25, "DiagnosticInfo" },
169 { 0x80, "Array of Null" },
170 { 0x80+1, "Array of Boolean" },
171 { 0x80+2, "Array of SByte" },
172 { 0x80+3, "Array of Byte" },
173 { 0x80+4, "Array of Int16" },
174 { 0x80+5, "Array of UInt16" },
175 { 0x80+6, "Array of Int32" },
176 { 0x80+7, "Array of UInt32" },
177 { 0x80+8, "Array of Int64" },
178 { 0x80+9, "Array of UInt64" },
179 { 0x80+10, "Array of Float" },
180 { 0x80+11, "Array of Double" },
181 { 0x80+12, "Array of String" },
182 { 0x80+13, "Array of DateTime" },
183 { 0x80+14, "Array of Guid" },
184 { 0x80+15, "Array of ByteString" },
185 { 0x80+16, "Array of XmlElement" },
186 { 0x80+17, "Array of NodeId" },
187 { 0x80+18, "Array of ExpandedNodeId" },
188 { 0x80+19, "Array of StatusCode" },
189 { 0x80+20, "Array of QualifiedName" },
190 { 0x80+21, "Array of LocalizedText" },
191 { 0x80+22, "Array of ExtensionObject" },
192 { 0x80+23, "Array of DataValue" },
193 { 0x80+24, "Array of Variant" },
194 { 0x80+25, "Array of DiagnosticInfo" },
197 #define VARIANT_ARRAYDIMENSIONS 0x40
198 #define VARIANT_ARRAYMASK 0x80
201 static gint ett_opcua_array = -1;
202 static gint ett_opcua_diagnosticinfo = -1;
203 static gint ett_opcua_nodeid = -1;
204 static gint ett_opcua_localeid = -1;
205 static gint ett_opcua_localizedtext = -1;
206 static gint ett_opcua_qualifiedname = -1;
207 static gint ett_opcua_datavalue = -1;
208 static gint ett_opcua_variant = -1;
209 static gint ett_opcua_extensionobject = -1;
210 static gint ett_opcua_extobj_encodingmask = -1;
214 &ett_opcua_diagnosticinfo,
217 &ett_opcua_localizedtext,
218 &ett_opcua_qualifiedname,
219 &ett_opcua_datavalue,
221 &ett_opcua_extensionobject,
222 &ett_opcua_extobj_encodingmask
225 void registerSimpleTypes(int proto)
227 static hf_register_info hf[] =
229 /* full name , abbreviation , type , display , strings, bitmask, blurb, id, parent, ref_count, bitshift */
230 { &hf_opcua_diag_mask_symbolicflag,
231 { "has symbolic id", "opcua.has_symbolic_id", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_SYMBOLICID_FLAG, NULL, HFILL }
233 { &hf_opcua_diag_mask_namespaceflag,
234 { "has namespace", "opcua.has_namespace", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_NAMESPACE_FLAG, NULL, HFILL }
236 { &hf_opcua_diag_mask_localizedtextflag,
237 { "has localizedtext", "opcua.has_localizedtext", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_LOCALIZEDTEXT_FLAG, NULL, HFILL }
239 { &hf_opcua_diag_mask_additionalinfoflag,
240 { "has additional info", "opcua.has_additional_info", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_ADDITIONALINFO_FLAG, NULL, HFILL }
242 { &hf_opcua_diag_mask_innerstatuscodeflag,
243 { "has inner statuscode", "opcua.has_inner_statuscode", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_INNERSTATUSCODE_FLAG, NULL, HFILL }
245 { &hf_opcua_diag_mask_innerdiaginfoflag,
246 { "has inner diagnostic info", "opcua.has_inner_diagnostic_code", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_INNERDIAGNOSTICINFO_FLAG, NULL, HFILL }
248 { &hf_opcua_loctext_mask_localeflag,
249 { "has locale information", "opcua.has_locale_information", FT_BOOLEAN, 8, NULL, LOCALIZEDTEXT_ENCODINGBYTE_LOCALE, NULL, HFILL }
251 { &hf_opcua_loctext_mask_textflag,
252 { "has text", "opcua.has_text", FT_BOOLEAN, 8, NULL, LOCALIZEDTEXT_ENCODINGBYTE_TEXT, NULL, HFILL }
254 { &hf_opcua_nodeid_encodingmask,
255 { "NodeId EncodingMask", "application.nodeid.encodingmask", FT_UINT8, BASE_HEX, VALS(g_nodeidmasks), 0x0, NULL, HFILL }
257 { &hf_opcua_nodeid_nsid,
258 { "NodeId Namespace Id", "application.nodeid.nsid", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
260 { &hf_opcua_nodeid_numeric,
261 { "NodeId Identifier Numeric", "application.nodeid.numeric", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
263 { &hf_opcua_localizedtext_locale, { "Locale", "opcua.Locale", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
264 { &hf_opcua_localizedtext_text, { "Text", "opcua.Text", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
265 { &hf_opcua_qualifiedname_id, { "Id", "opcua.Id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
266 { &hf_opcua_qualifiedname_name, { "Name", "opcua.Name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
267 { &hf_opcua_datavalue_mask_valueflag, { "has value", "opcua.has_value", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_VALUE, NULL, HFILL } },
268 { &hf_opcua_datavalue_mask_statuscodeflag, { "has statuscode", "opcua.has_statuscode", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_STATUSCODE, NULL, HFILL } },
269 { &hf_opcua_datavalue_mask_sourcetimestampflag, { "has source timestamp", "opcua.has_source_timestamp", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_SOURCETIMESTAMP, NULL, HFILL } },
270 { &hf_opcua_datavalue_mask_servertimestampflag, { "has server timestamp", "opcua.has_server_timestamp", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_SERVERTIMESTAMP, NULL, HFILL } },
271 { &hf_opcua_datavalue_mask_sourcepicoseconds, { "has source picoseconds", "opcua.has_source_picoseconds", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_SOURCEPICOSECONDS, NULL, HFILL } },
272 { &hf_opcua_datavalue_mask_serverpicoseconds, { "has server picoseconds", "opcua.has_server_picoseconds", FT_BOOLEAN, 8, NULL, DATAVALUE_ENCODINGBYTE_SERVERPICOSECONDS, NULL, HFILL } },
273 { &hf_opcua_variant_encodingmask, { "Variant Type", "opcua.has_value", FT_UINT8, BASE_HEX, VALS(g_VariantTypes), 0x0, NULL, HFILL } },
274 { &hf_opcua_SourceTimestamp, { "SourceTimestamp", "opcua.SourceTimestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } },
275 { &hf_opcua_SourcePicoseconds, { "SourcePicoseconds", "opcua.SourcePicoseconds", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
276 { &hf_opcua_ServerTimestamp, { "ServerTimestamp", "opcua.ServerTimestamp", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } },
277 { &hf_opcua_ServerPicoseconds, { "ServerPicoseconds", "opcua.ServerPicoseconds", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
278 { &hf_opcua_diag_symbolicid, { "SymbolicId", "opcua.SymbolicId", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
279 { &hf_opcua_diag_namespace, { "Namespace", "opcua.Namespace", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
280 { &hf_opcua_diag_localizedtext, { "LocaliezdText", "opcua.LocaliezdText", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
281 { &hf_opcua_diag_additionalinfo, { "AdditionalInfo", "opcua.AdditionalInfo", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
282 { &hf_opcua_diag_innerstatuscode, { "InnerStatusCode", "opcua.InnerStatusCode", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
283 { &hf_opcua_extobj_mask_binbodyflag, { "has binary body", "opcua.has_binary_body", FT_BOOLEAN, 8, NULL, EXTOBJ_ENCODINGMASK_BINBODY_FLAG, NULL, HFILL } },
284 { &hf_opcua_extobj_mask_xmlbodyflag, { "has xml body", "opcua.has_xml_body", FT_BOOLEAN, 8, NULL, EXTOBJ_ENCODINGMASK_XMLBODY_FLAG, NULL, HFILL } },
285 { &hf_opcua_ArraySize, { "ArraySize", "opcua.ArraySize", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
286 { &hf_opcua_Uri, { "Uri", "opcua.Uri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
287 { &hf_opcua_ServerIndex, { "ServerIndex", "opcua.ServerIndex", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }
290 proto_register_field_array(proto, hf, array_length(hf));
291 proto_register_subtree_array(ett, array_length(ett));
294 void parseBoolean(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
296 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN); *pOffset+=1;
299 void parseByte(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
301 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN); *pOffset+=1;
304 void parseSByte(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
306 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN); *pOffset+=1;
309 void parseUInt16(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
311 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 2, ENC_LITTLE_ENDIAN); *pOffset+=2;
314 void parseInt16(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
316 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 2, ENC_LITTLE_ENDIAN); *pOffset+=2;
319 void parseUInt32(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
321 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4;
324 void parseInt32(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
326 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4;
329 void parseUInt64(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
331 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 8, ENC_LITTLE_ENDIAN); *pOffset+=8;
334 void parseInt64(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
336 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 8, ENC_LITTLE_ENDIAN); *pOffset+=8;
339 void parseString(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
342 gint iOffset = *pOffset;
343 gint32 iLen = tvb_get_letohl(tvb, *pOffset);
348 proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, iOffset, 0, ENC_ASCII|ENC_NA);
349 proto_item_append_text(item, "[OpcUa Null String]");
353 proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, iOffset, 0, ENC_ASCII|ENC_NA);
354 proto_item_append_text(item, "[OpcUa Empty String]");
358 proto_tree_add_item(tree, hfIndex, tvb, iOffset, iLen, ENC_ASCII|ENC_NA);
359 iOffset += iLen; /* eat the whole string */
363 proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, iOffset, 0, ENC_ASCII|ENC_NA);
364 szValue = ep_strdup_printf("[Invalid String] Invalid length: %d", iLen);
365 proto_item_append_text(item, "%s", szValue);
371 void parseStatusCode(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
373 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN);
377 void parseLocalizedText(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
379 gint iOffset = *pOffset;
381 proto_tree *mask_tree;
385 ti = proto_tree_add_text(tree, tvb, 0, -1, "%s: LocalizedText", szFieldName);
386 subtree = proto_item_add_subtree(ti, ett_opcua_localizedtext);
388 /* parse encoding mask */
389 EncodingMask = tvb_get_guint8(tvb, iOffset);
390 ti = proto_tree_add_text(subtree, tvb, 0, -1, "EncodingMask");
391 mask_tree = proto_item_add_subtree(ti, ett_opcua_localizedtext);
392 proto_tree_add_item(mask_tree, hf_opcua_loctext_mask_localeflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
393 proto_tree_add_item(mask_tree, hf_opcua_loctext_mask_textflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
396 if (EncodingMask & LOCALIZEDTEXT_ENCODINGBYTE_LOCALE)
398 parseString(subtree, tvb, &iOffset, hf_opcua_localizedtext_locale);
401 if (EncodingMask & LOCALIZEDTEXT_ENCODINGBYTE_TEXT)
403 parseString(subtree, tvb, &iOffset, hf_opcua_localizedtext_text);
409 void parseGuid(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
411 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, GUID_LEN, ENC_NA); *pOffset+=GUID_LEN;
414 void parseByteString(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
417 int iOffset = *pOffset;
418 gint32 iLen = tvb_get_letohl(tvb, iOffset);
423 proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, iOffset, 0, ENC_NA);
424 proto_item_append_text(item, "[OpcUa Null ByteString]");
428 proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, iOffset, 0, ENC_NA);
429 proto_item_append_text(item, "[OpcUa Empty ByteString]");
433 proto_tree_add_item(tree, hfIndex, tvb, iOffset, iLen, ENC_NA);
434 iOffset += iLen; /* eat the whole bytestring */
438 proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, iOffset, 0, ENC_NA);
439 szValue = ep_strdup_printf("[Invalid ByteString] Invalid length: %d", iLen);
440 proto_item_append_text(item, "%s", szValue);
446 void parseXmlElement(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
448 parseByteString(tree, tvb, pOffset, hfIndex);
451 void parseFloat(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
453 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, (int)sizeof(gfloat), ENC_LITTLE_ENDIAN);
454 *pOffset += (int)sizeof(gfloat);
457 void parseDouble(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
459 proto_tree_add_item(tree, hfIndex, tvb, *pOffset, (int)sizeof(gdouble), ENC_LITTLE_ENDIAN);
460 *pOffset += (int)sizeof(gdouble);
463 void parseDateTime(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
465 *pOffset = dissect_nt_64bit_time(tvb, tree, *pOffset, hfIndex);
468 void parseDiagnosticInfo(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
470 gint iOffset = *pOffset;
472 proto_tree *mask_tree;
476 ti = proto_tree_add_text(tree, tvb, 0, -1, "%s: DiagnosticInfo", szFieldName);
477 subtree = proto_item_add_subtree(ti, ett_opcua_diagnosticinfo);
479 /* parse encoding mask */
480 EncodingMask = tvb_get_guint8(tvb, iOffset);
481 ti = proto_tree_add_text(subtree, tvb, 0, -1, "EncodingMask");
482 mask_tree = proto_item_add_subtree(ti, ett_opcua_diagnosticinfo);
483 proto_tree_add_item(mask_tree, hf_opcua_diag_mask_symbolicflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
484 proto_tree_add_item(mask_tree, hf_opcua_diag_mask_namespaceflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
485 proto_tree_add_item(mask_tree, hf_opcua_diag_mask_localizedtextflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
486 proto_tree_add_item(mask_tree, hf_opcua_diag_mask_additionalinfoflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
487 proto_tree_add_item(mask_tree, hf_opcua_diag_mask_innerstatuscodeflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
488 proto_tree_add_item(mask_tree, hf_opcua_diag_mask_innerdiaginfoflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
491 if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_SYMBOLICID_FLAG)
493 parseInt32(subtree, tvb, &iOffset, hf_opcua_diag_symbolicid);
495 if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_NAMESPACE_FLAG)
497 parseInt32(subtree, tvb, &iOffset, hf_opcua_diag_namespace);
499 if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_LOCALIZEDTEXT_FLAG)
501 parseInt32(subtree, tvb, &iOffset, hf_opcua_diag_localizedtext);
503 if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_ADDITIONALINFO_FLAG)
505 parseString(subtree, tvb, &iOffset, hf_opcua_diag_additionalinfo);
507 if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_INNERSTATUSCODE_FLAG)
509 parseStatusCode(subtree, tvb, &iOffset, hf_opcua_diag_innerstatuscode);
511 if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_INNERDIAGNOSTICINFO_FLAG)
513 parseDiagnosticInfo(subtree, tvb, &iOffset, "Inner DiagnosticInfo");
519 void parseQualifiedName(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
521 proto_item *ti = proto_tree_add_text(tree, tvb, 0, -1, "%s: QualifiedName", szFieldName);
522 proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_qualifiedname);
524 parseUInt16(subtree, tvb, pOffset, hf_opcua_qualifiedname_id);
525 parseString(subtree, tvb, pOffset, hf_opcua_qualifiedname_name);
528 void parseDataValue(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
530 proto_item *ti = proto_tree_add_text(tree, tvb, 0, -1, "%s: DataValue", szFieldName);
531 proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_datavalue);
532 proto_tree *mask_tree;
533 gint iOffset = *pOffset;
536 EncodingMask = tvb_get_guint8(tvb, iOffset);
537 ti = proto_tree_add_text(subtree, tvb, 0, -1, "EncodingMask");
538 mask_tree = proto_item_add_subtree(ti, ett_opcua_datavalue);
539 proto_tree_add_item(mask_tree, hf_opcua_datavalue_mask_valueflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
540 proto_tree_add_item(mask_tree, hf_opcua_datavalue_mask_statuscodeflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
541 proto_tree_add_item(mask_tree, hf_opcua_datavalue_mask_sourcetimestampflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
542 proto_tree_add_item(mask_tree, hf_opcua_datavalue_mask_servertimestampflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
543 proto_tree_add_item(mask_tree, hf_opcua_datavalue_mask_sourcepicoseconds, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
544 proto_tree_add_item(mask_tree, hf_opcua_datavalue_mask_serverpicoseconds, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
547 if (EncodingMask & DATAVALUE_ENCODINGBYTE_VALUE)
549 parseVariant(subtree, tvb, &iOffset, "Value");
551 if (EncodingMask & DATAVALUE_ENCODINGBYTE_STATUSCODE)
553 parseStatusCode(subtree, tvb, &iOffset, hf_opcua_StatusCode);
555 if (EncodingMask & DATAVALUE_ENCODINGBYTE_SOURCETIMESTAMP)
557 parseDateTime(subtree, tvb, &iOffset, hf_opcua_SourceTimestamp);
559 if (EncodingMask & DATAVALUE_ENCODINGBYTE_SOURCEPICOSECONDS)
561 parseUInt16(subtree, tvb, &iOffset, hf_opcua_SourcePicoseconds);
563 if (EncodingMask & DATAVALUE_ENCODINGBYTE_SERVERTIMESTAMP)
565 parseDateTime(subtree, tvb, &iOffset, hf_opcua_ServerTimestamp);
567 if (EncodingMask & DATAVALUE_ENCODINGBYTE_SERVERPICOSECONDS)
569 parseUInt16(subtree, tvb, &iOffset, hf_opcua_ServerPicoseconds);
575 void parseVariant(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
577 proto_item *ti = proto_tree_add_text(tree, tvb, 0, -1, "%s: Variant", szFieldName);
578 proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_variant);
579 gint iOffset = *pOffset;
581 gint32 ArrayLength = 0;
583 EncodingMask = tvb_get_guint8(tvb, iOffset);
584 proto_tree_add_item(subtree, hf_opcua_variant_encodingmask, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
587 if (EncodingMask & VARIANT_ARRAYMASK)
589 ArrayLength = tvb_get_letohl(tvb, iOffset);
591 /* type is encoded in bits 0-5 */
592 switch(EncodingMask & 0x3f)
594 case OpcUaType_Null: break;
595 case OpcUaType_Boolean: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Boolean, parseBoolean); break;
596 case OpcUaType_SByte: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_SByte, parseSByte); break;
597 case OpcUaType_Byte: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Byte, parseByte); break;
598 case OpcUaType_Int16: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Int16, parseInt16); break;
599 case OpcUaType_UInt16: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_UInt16, parseUInt16); break;
600 case OpcUaType_Int32: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Int32, parseInt32); break;
601 case OpcUaType_UInt32: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_UInt32, parseUInt32); break;
602 case OpcUaType_Int64: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Int64, parseInt64); break;
603 case OpcUaType_UInt64: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_UInt64, parseUInt64); break;
604 case OpcUaType_Float: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Float, parseFloat); break;
605 case OpcUaType_Double: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Double, parseDouble); break;
606 case OpcUaType_String: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_String, parseString); break;
607 case OpcUaType_DateTime: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_DateTime, parseDateTime); break;
608 case OpcUaType_Guid: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Guid, parseGuid); break;
609 case OpcUaType_ByteString: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_ByteString, parseByteString); break;
610 case OpcUaType_XmlElement: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_XmlElement, parseXmlElement); break;
611 case OpcUaType_NodeId: parseArrayComplex(subtree, tvb, &iOffset, "NodeId", parseNodeId); break;
612 case OpcUaType_ExpandedNodeId: parseArrayComplex(subtree, tvb, &iOffset, "ExpandedNodeId", parseExpandedNodeId); break;
613 case OpcUaType_StatusCode: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_StatusCode, parseStatusCode); break;
614 case OpcUaType_DiagnosticInfo: parseArrayComplex(subtree, tvb, &iOffset, "DiagnosticInfo", parseDiagnosticInfo); break;
615 case OpcUaType_QualifiedName: parseArrayComplex(subtree, tvb, &iOffset, "QualifiedName", parseQualifiedName); break;
616 case OpcUaType_LocalizedText: parseArrayComplex(subtree, tvb, &iOffset, "LocalizedText", parseLocalizedText); break;
617 case OpcUaType_ExtensionObject: parseArrayComplex(subtree, tvb, &iOffset, "ExtensionObject", parseExtensionObject); break;
618 case OpcUaType_DataValue: parseArrayComplex(subtree, tvb, &iOffset, "DataValue", parseDataValue); break;
619 case OpcUaType_Variant: parseArrayComplex(subtree, tvb, &iOffset, "Variant", parseVariant); break;
622 if (EncodingMask & VARIANT_ARRAYDIMENSIONS)
624 proto_item *ti_2 = proto_tree_add_text(tree, tvb, 0, -1, "Array Dimensions");
625 proto_tree *subtree_2 = proto_item_add_subtree(ti_2, ett_opcua_array);
628 if (ArrayLength < MAX_ARRAY_LEN)
630 for (i=0; i<ArrayLength; i++)
632 parseInt32(subtree_2, tvb, pOffset, hf_opcua_Int32);
638 /* XXX - This should be expert_add_info_format, but we need pinfo for that */
639 pi = proto_tree_add_text(tree, tvb, iOffset, 4, "Array length %d too large to process", ArrayLength);
640 PROTO_ITEM_SET_GENERATED(pi);
646 /* type is encoded in bits 0-5 */
647 switch(EncodingMask & 0x3f)
649 case OpcUaType_Null: break;
650 case OpcUaType_Boolean: parseBoolean(subtree, tvb, &iOffset, hf_opcua_Boolean); break;
651 case OpcUaType_SByte: parseSByte(subtree, tvb, &iOffset, hf_opcua_SByte); break;
652 case OpcUaType_Byte: parseByte(subtree, tvb, &iOffset, hf_opcua_Byte); break;
653 case OpcUaType_Int16: parseInt16(subtree, tvb, &iOffset, hf_opcua_Int16); break;
654 case OpcUaType_UInt16: parseUInt16(subtree, tvb, &iOffset, hf_opcua_UInt16); break;
655 case OpcUaType_Int32: parseInt32(subtree, tvb, &iOffset, hf_opcua_Int32); break;
656 case OpcUaType_UInt32: parseUInt32(subtree, tvb, &iOffset, hf_opcua_UInt32); break;
657 case OpcUaType_Int64: parseInt64(subtree, tvb, &iOffset, hf_opcua_Int64); break;
658 case OpcUaType_UInt64: parseUInt64(subtree, tvb, &iOffset, hf_opcua_UInt64); break;
659 case OpcUaType_Float: parseFloat(subtree, tvb, &iOffset, hf_opcua_Float); break;
660 case OpcUaType_Double: parseDouble(subtree, tvb, &iOffset, hf_opcua_Double); break;
661 case OpcUaType_String: parseString(subtree, tvb, &iOffset, hf_opcua_String); break;
662 case OpcUaType_DateTime: parseDateTime(subtree, tvb, &iOffset, hf_opcua_DateTime); break;
663 case OpcUaType_Guid: parseGuid(subtree, tvb, &iOffset, hf_opcua_Guid); break;
664 case OpcUaType_ByteString: parseByteString(subtree, tvb, &iOffset, hf_opcua_ByteString); break;
665 case OpcUaType_XmlElement: parseXmlElement(subtree, tvb, &iOffset, hf_opcua_XmlElement); break;
666 case OpcUaType_NodeId: parseNodeId(subtree, tvb, &iOffset, "Value"); break;
667 case OpcUaType_ExpandedNodeId: parseExpandedNodeId(subtree, tvb, &iOffset, "Value"); break;
668 case OpcUaType_StatusCode: parseStatusCode(subtree, tvb, &iOffset, hf_opcua_StatusCode); break;
669 case OpcUaType_DiagnosticInfo: parseDiagnosticInfo(subtree, tvb, &iOffset, "Value"); break;
670 case OpcUaType_QualifiedName: parseQualifiedName(subtree, tvb, &iOffset, "Value"); break;
671 case OpcUaType_LocalizedText: parseLocalizedText(subtree, tvb, &iOffset, "Value"); break;
672 case OpcUaType_ExtensionObject: parseExtensionObject(subtree, tvb, &iOffset, "Value"); break;
673 case OpcUaType_DataValue: parseDataValue(subtree, tvb, &iOffset, "Value"); break;
674 case OpcUaType_Variant: parseVariant(subtree, tvb, &iOffset, "Value"); break;
681 /** General parsing function for arrays of simple types.
682 * All arrays have one 4 byte signed integer length information,
683 * followed by n data elements.
685 void parseArraySimple(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex, fctSimpleTypeParser pParserFunction)
687 static const char szFieldName[] = "Array of Simple Type";
688 proto_item *ti = proto_tree_add_text(tree, tvb, 0, -1, "%s", szFieldName);
689 proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_array);
693 /* read array length */
694 iLen = tvb_get_letohl(tvb, *pOffset);
695 proto_tree_add_item(subtree, hf_opcua_ArraySize, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN);
697 if (iLen > MAX_ARRAY_LEN)
700 pi = proto_tree_add_text(tree, tvb, *pOffset, 4, "Array length %d too large to process", iLen);
701 PROTO_ITEM_SET_GENERATED(pi);
706 for (i=0; i<iLen; i++)
708 (*pParserFunction)(subtree, tvb, pOffset, hfIndex);
712 /** General parsing function for arrays of enums.
713 * All arrays have one 4 byte signed integer length information,
714 * followed by n data elements.
716 void parseArrayEnum(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, fctEnumParser pParserFunction)
718 static const char szFieldName[] = "Array of Enum Type";
719 proto_item *ti = proto_tree_add_text(tree, tvb, 0, -1, "%s", szFieldName);
720 proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_array);
724 /* read array length */
725 iLen = tvb_get_letohl(tvb, *pOffset);
726 proto_tree_add_item(subtree, hf_opcua_ArraySize, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN);
728 if (iLen > MAX_ARRAY_LEN)
731 pi = proto_tree_add_text(tree, tvb, *pOffset, 4, "Array length %d too large to process", iLen);
732 PROTO_ITEM_SET_GENERATED(pi);
737 for (i=0; i<iLen; i++)
739 (*pParserFunction)(subtree, tvb, pOffset);
743 /** General parsing function for arrays of complex types.
744 * All arrays have one 4 byte signed integer length information,
745 * followed by n data elements.
747 void parseArrayComplex(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName, fctComplexTypeParser pParserFunction)
749 proto_item *ti = proto_tree_add_text(tree, tvb, 0, -1, "Array of %s", szFieldName);
750 proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_array);
754 /* read array length */
755 iLen = tvb_get_letohl(tvb, *pOffset);
756 proto_tree_add_item(subtree, hf_opcua_ArraySize, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN);
758 if (iLen > MAX_ARRAY_LEN)
761 pi = proto_tree_add_text(tree, tvb, *pOffset, 4, "Array length %d too large to process", iLen);
762 PROTO_ITEM_SET_GENERATED(pi);
767 for (i=0; i<iLen; i++)
770 g_snprintf(szNum, 20, "[%i]", i);
771 (*pParserFunction)(subtree, tvb, pOffset, szNum);
775 void parseNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
777 proto_item *ti = proto_tree_add_text(tree, tvb, 0, -1, "%s: NodeId", szFieldName);
778 proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_nodeid);
779 gint iOffset = *pOffset;
782 EncodingMask = tvb_get_guint8(tvb, iOffset);
783 proto_tree_add_item(subtree, hf_opcua_nodeid_encodingmask, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
788 case 0x00: /* two byte node id */
789 proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
792 case 0x01: /* four byte node id */
793 proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
795 proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 2, ENC_LITTLE_ENDIAN);
798 case 0x02: /* numeric, that does not fit into four bytes */
799 proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 2, ENC_LITTLE_ENDIAN);
801 proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 4, ENC_LITTLE_ENDIAN);
804 case 0x03: /* string */
805 proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 2, ENC_LITTLE_ENDIAN);
807 parseString(subtree, tvb, &iOffset, hf_opcua_String);
809 case 0x04: /* guid */
810 proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 2, ENC_LITTLE_ENDIAN);
812 parseGuid(subtree, tvb, &iOffset, hf_opcua_Guid);
814 case 0x05: /* byte string */
815 proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 2, ENC_LITTLE_ENDIAN);
817 parseByteString(subtree, tvb, &iOffset, hf_opcua_ByteString);
824 void parseExtensionObject(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
826 gint iOffset = *pOffset;
829 proto_tree *extobj_tree;
830 proto_tree *mask_tree;
833 /* add extension object subtree */
834 ti = proto_tree_add_text(tree, tvb, 0, -1, "%s : ExtensionObject", szFieldName);
835 extobj_tree = proto_item_add_subtree(ti, ett_opcua_extensionobject);
837 /* add nodeid subtree */
838 TypeId = getExtensionObjectType(tvb, &iOffset);
839 parseExpandedNodeId(extobj_tree, tvb, &iOffset, "TypeId");
841 /* parse encoding mask */
842 EncodingMask = tvb_get_guint8(tvb, iOffset);
843 ti = proto_tree_add_text(extobj_tree, tvb, 0, -1, "EncodingMask");
844 mask_tree = proto_item_add_subtree(ti, ett_opcua_extobj_encodingmask);
845 proto_tree_add_item(mask_tree, hf_opcua_extobj_mask_binbodyflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
846 proto_tree_add_item(mask_tree, hf_opcua_extobj_mask_xmlbodyflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
849 if (EncodingMask & EXTOBJ_ENCODINGMASK_BINBODY_FLAG) /* has binary body ? */
851 dispatchExtensionObjectType(extobj_tree, tvb, &iOffset, TypeId);
857 void parseExpandedNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
859 proto_item *ti = proto_tree_add_text(tree, tvb, 0, -1, "%s: ExpandedNodeId", szFieldName);
860 proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_nodeid);
861 gint iOffset = *pOffset;
864 EncodingMask = tvb_get_guint8(tvb, iOffset);
865 proto_tree_add_item(subtree, hf_opcua_nodeid_encodingmask, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
870 case 0x00: /* two byte node id */
871 proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
874 case 0x01: /* four byte node id */
875 proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
877 proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 2, ENC_LITTLE_ENDIAN);
880 case 0x02: /* numeric, that does not fit into four bytes */
881 proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 2, ENC_LITTLE_ENDIAN);
883 proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 4, ENC_LITTLE_ENDIAN);
886 case 0x03: /* string */
887 proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 2, ENC_LITTLE_ENDIAN);
889 parseString(subtree, tvb, &iOffset, hf_opcua_String);
891 case 0x04: /* guid */
892 proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 2, ENC_LITTLE_ENDIAN);
894 parseGuid(subtree, tvb, &iOffset, hf_opcua_Guid);
896 case 0x05: /* byte string */
897 proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 2, ENC_LITTLE_ENDIAN);
899 parseByteString(subtree, tvb, &iOffset, hf_opcua_ByteString);
903 if (EncodingMask & NODEID_URIMASK)
905 parseString(subtree, tvb, &iOffset, hf_opcua_Uri);
907 if (EncodingMask & NODEID_SERVERINDEXFLAG)
909 parseUInt32(subtree, tvb, &iOffset, hf_opcua_ServerIndex);
915 guint32 getExtensionObjectType(tvbuff_t *tvb, gint *pOffset)
917 gint iOffset = *pOffset;
921 EncodingMask = tvb_get_guint8(tvb, iOffset);
926 case 0x00: /* two byte node id */
927 Numeric = tvb_get_guint8(tvb, iOffset);
930 case 0x01: /* four byte node id */
932 Numeric = tvb_get_letohs(tvb, iOffset);
934 case 0x02: /* numeric, that does not fit into four bytes */
936 Numeric = tvb_get_letohl(tvb, iOffset);
938 case 0x03: /* string */
940 case 0x05: /* guid */
941 case 0x06: /* byte string */