#define DIAGNOSTICINFO_ENCODINGMASK_SYMBOLICID_FLAG 0x01
#define DIAGNOSTICINFO_ENCODINGMASK_NAMESPACE_FLAG 0x02
#define DIAGNOSTICINFO_ENCODINGMASK_LOCALIZEDTEXT_FLAG 0x04
-#define DIAGNOSTICINFO_ENCODINGMASK_ADDITIONALINFO_FLAG 0x08
-#define DIAGNOSTICINFO_ENCODINGMASK_INNERSTATUSCODE_FLAG 0x10
-#define DIAGNOSTICINFO_ENCODINGMASK_INNERDIAGNOSTICINFO_FLAG 0x20
+#define DIAGNOSTICINFO_ENCODINGMASK_LOCALE_FLAG 0x08
+#define DIAGNOSTICINFO_ENCODINGMASK_ADDITIONALINFO_FLAG 0x10
+#define DIAGNOSTICINFO_ENCODINGMASK_INNERSTATUSCODE_FLAG 0x20
+#define DIAGNOSTICINFO_ENCODINGMASK_INNERDIAGNOSTICINFO_FLAG 0x40
#define LOCALIZEDTEXT_ENCODINGBYTE_LOCALE 0x01
#define LOCALIZEDTEXT_ENCODINGBYTE_TEXT 0x02
#define NODEID_NAMESPACEURIFLAG 0x80
static int hf_opcua_diag_mask_symbolicflag = -1;
static int hf_opcua_diag_mask_namespaceflag = -1;
static int hf_opcua_diag_mask_localizedtextflag = -1;
+static int hf_opcua_diag_mask_localeflag = -1;
static int hf_opcua_diag_mask_additionalinfoflag = -1;
static int hf_opcua_diag_mask_innerstatuscodeflag = -1;
static int hf_opcua_diag_mask_innerdiaginfoflag = -1;
static int hf_opcua_diag_symbolicid = -1;
static int hf_opcua_diag_namespace = -1;
static int hf_opcua_diag_localizedtext = -1;
+static int hf_opcua_diag_locale = -1;
static int hf_opcua_diag_additionalinfo = -1;
static int hf_opcua_diag_innerstatuscode = -1;
static int hf_opcua_extobj_mask_binbodyflag = -1;
#define VARIANT_ARRAYMASK 0x80
/* trees */
-static gint ett_opcua_array = -1;
static gint ett_opcua_diagnosticinfo = -1;
+static gint ett_opcua_diagnosticinfo_encodingmask = -1;
static gint ett_opcua_nodeid = -1;
-static gint ett_opcua_localeid = -1;
+static gint ett_opcua_expandednodeid = -1;
static gint ett_opcua_localizedtext = -1;
+static gint ett_opcua_localizedtext_encodingmask = -1;
static gint ett_opcua_qualifiedname = -1;
static gint ett_opcua_datavalue = -1;
+static gint ett_opcua_datavalue_encodingmask = -1;
static gint ett_opcua_variant = -1;
+static gint ett_opcua_variant_arraydims = -1;
static gint ett_opcua_extensionobject = -1;
-static gint ett_opcua_extobj_encodingmask = -1;
+static gint ett_opcua_extensionobject_encodingmask = -1;
static gint ett_opcua_statuscode = -1;
static gint ett_opcua_statuscode_info = -1;
+gint ett_opcua_array_Boolean = -1;
+gint ett_opcua_array_SByte = -1;
+gint ett_opcua_array_Byte = -1;
+gint ett_opcua_array_Int16 = -1;
+gint ett_opcua_array_UInt16 = -1;
+gint ett_opcua_array_Int32 = -1;
+gint ett_opcua_array_UInt32 = -1;
+gint ett_opcua_array_Int64 = -1;
+gint ett_opcua_array_UInt64 = -1;
+gint ett_opcua_array_Float = -1;
+gint ett_opcua_array_Double = -1;
+gint ett_opcua_array_String = -1;
+gint ett_opcua_array_DateTime = -1;
+gint ett_opcua_array_Guid = -1;
+gint ett_opcua_array_ByteString = -1;
+gint ett_opcua_array_XmlElement = -1;
+gint ett_opcua_array_NodeId = -1;
+gint ett_opcua_array_ExpandedNodeId = -1;
+gint ett_opcua_array_StatusCode = -1;
+gint ett_opcua_array_DiagnosticInfo = -1;
+gint ett_opcua_array_QualifiedName = -1;
+gint ett_opcua_array_LocalizedText = -1;
+gint ett_opcua_array_ExtensionObject = -1;
+gint ett_opcua_array_DataValue = -1;
+gint ett_opcua_array_Variant = -1;
static gint *ett[] =
{
- &ett_opcua_array,
&ett_opcua_diagnosticinfo,
+ &ett_opcua_diagnosticinfo_encodingmask,
&ett_opcua_nodeid,
- &ett_opcua_localeid,
+ &ett_opcua_expandednodeid,
&ett_opcua_localizedtext,
+ &ett_opcua_localizedtext_encodingmask,
&ett_opcua_qualifiedname,
&ett_opcua_datavalue,
+ &ett_opcua_datavalue_encodingmask,
&ett_opcua_variant,
+ &ett_opcua_variant_arraydims,
&ett_opcua_extensionobject,
- &ett_opcua_extobj_encodingmask,
+ &ett_opcua_extensionobject_encodingmask,
&ett_opcua_statuscode,
- &ett_opcua_statuscode_info
+ &ett_opcua_statuscode_info,
+ &ett_opcua_array_Boolean,
+ &ett_opcua_array_SByte,
+ &ett_opcua_array_Byte,
+ &ett_opcua_array_Int16,
+ &ett_opcua_array_UInt16,
+ &ett_opcua_array_Int32,
+ &ett_opcua_array_UInt32,
+ &ett_opcua_array_Int64,
+ &ett_opcua_array_UInt64,
+ &ett_opcua_array_Float,
+ &ett_opcua_array_Double,
+ &ett_opcua_array_String,
+ &ett_opcua_array_DateTime,
+ &ett_opcua_array_Guid,
+ &ett_opcua_array_ByteString,
+ &ett_opcua_array_XmlElement,
+ &ett_opcua_array_NodeId,
+ &ett_opcua_array_ExpandedNodeId,
+ &ett_opcua_array_StatusCode,
+ &ett_opcua_array_DiagnosticInfo,
+ &ett_opcua_array_QualifiedName,
+ &ett_opcua_array_LocalizedText,
+ &ett_opcua_array_ExtensionObject,
+ &ett_opcua_array_DataValue,
+ &ett_opcua_array_Variant
};
void registerSimpleTypes(int proto)
{ &hf_opcua_diag_mask_localizedtextflag,
{ "has localizedtext", "opcua.has_localizedtext", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_LOCALIZEDTEXT_FLAG, NULL, HFILL }
},
+ { &hf_opcua_diag_mask_localeflag,
+ { "has locale", "opcua.has_locale", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_LOCALE_FLAG, NULL, HFILL }
+ },
{ &hf_opcua_diag_mask_additionalinfoflag,
{ "has additional info", "opcua.has_additional_info", FT_BOOLEAN, 8, NULL, DIAGNOSTICINFO_ENCODINGMASK_ADDITIONALINFO_FLAG, NULL, HFILL }
},
{ &hf_opcua_ServerPicoseconds, { "ServerPicoseconds", "opcua.ServerPicoseconds", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_opcua_diag_symbolicid, { "SymbolicId", "opcua.SymbolicId", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_opcua_diag_namespace, { "Namespace", "opcua.Namespace", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
- { &hf_opcua_diag_localizedtext, { "LocaliezdText", "opcua.LocaliezdText", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_opcua_diag_localizedtext, { "LocalizedText", "opcua.LocalizedText", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_opcua_diag_locale, { "Locale", "opcua.Locale", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
{ &hf_opcua_diag_additionalinfo, { "AdditionalInfo", "opcua.AdditionalInfo", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } },
{ &hf_opcua_diag_innerstatuscode, { "InnerStatusCode", "opcua.InnerStatusCode", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
{ &hf_opcua_extobj_mask_binbodyflag, { "has binary body", "opcua.has_binary_body", FT_BOOLEAN, 8, NULL, EXTOBJ_ENCODINGMASK_BINBODY_FLAG, NULL, HFILL } },
proto_register_subtree_array(ett, array_length(ett));
}
-void parseBoolean(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseBoolean(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN); *pOffset+=1;
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN);
+ *pOffset+=1;
+ return item;
}
-void parseByte(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseByte(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN); *pOffset+=1;
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN);
+ *pOffset+=1;
+ return item;
}
-void parseSByte(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseSByte(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN); *pOffset+=1;
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 1, ENC_LITTLE_ENDIAN);
+ *pOffset+=1;
+ return item;
}
-void parseUInt16(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseUInt16(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 2, ENC_LITTLE_ENDIAN); *pOffset+=2;
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 2, ENC_LITTLE_ENDIAN);
+ *pOffset+=2;
+ return item;
}
-void parseInt16(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseInt16(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 2, ENC_LITTLE_ENDIAN); *pOffset+=2;
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 2, ENC_LITTLE_ENDIAN);
+ *pOffset+=2;
+ return item;
}
-void parseUInt32(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseUInt32(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4;
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN);
+ *pOffset+=4;
+ return item;
}
-void parseInt32(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseInt32(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4;
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN);
+ *pOffset+=4;
+ return item;
}
-void parseUInt64(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseUInt64(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 8, ENC_LITTLE_ENDIAN); *pOffset+=8;
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 8, ENC_LITTLE_ENDIAN);
+ *pOffset+=8;
+ return item;
}
-void parseInt64(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseInt64(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 8, ENC_LITTLE_ENDIAN); *pOffset+=8;
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 8, ENC_LITTLE_ENDIAN);
+ *pOffset+=8;
+ return item;
}
-void parseString(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseString(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
+ proto_item *item = NULL;
char *szValue;
gint iOffset = *pOffset;
gint32 iLen = tvb_get_letohl(tvb, *pOffset);
if (iLen == -1)
{
- proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
+ item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
proto_item_append_text(item, "[OpcUa Null String]");
proto_item_set_end(item, tvb, *pOffset + 4);
}
else if (iLen == 0)
{
- proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
+ item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
proto_item_append_text(item, "[OpcUa Empty String]");
proto_item_set_end(item, tvb, *pOffset + 4);
}
else if (iLen > 0)
{
- proto_tree_add_item(tree, hfIndex, tvb, iOffset, iLen, ENC_UTF_8|ENC_NA);
+ item = proto_tree_add_item(tree, hfIndex, tvb, iOffset, iLen, ENC_UTF_8|ENC_NA);
iOffset += iLen; /* eat the whole string */
}
else
{
- proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
+ item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
szValue = wmem_strdup_printf(wmem_packet_scope(), "[Invalid String] Invalid length: %d", iLen);
proto_item_append_text(item, "%s", szValue);
proto_item_set_end(item, tvb, *pOffset + 4);
}
*pOffset = iOffset;
+ return item;
}
-void parseStatusCode(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseStatusCode(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
proto_item *item = NULL;
guint32 uStatusCode = 0;
}
*pOffset += 4;
+ return item;
}
void parseLocalizedText(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
proto_item *ti;
proto_item *ti_inner;
- ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "%s: LocalizedText", szFieldName);
- subtree = proto_item_add_subtree(ti, ett_opcua_localizedtext);
+ subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_localizedtext, &ti, "%s: LocalizedText", szFieldName);
/* parse encoding mask */
EncodingMask = tvb_get_guint8(tvb, iOffset);
ti_inner = proto_tree_add_text(subtree, tvb, iOffset, 1, "EncodingMask");
- mask_tree = proto_item_add_subtree(ti_inner, ett_opcua_localizedtext);
+ mask_tree = proto_item_add_subtree(ti_inner, ett_opcua_localizedtext_encodingmask);
proto_tree_add_item(mask_tree, hf_opcua_loctext_mask_localeflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(mask_tree, hf_opcua_loctext_mask_textflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
iOffset++;
*pOffset = iOffset;
}
-void parseGuid(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseGuid(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, GUID_LEN, ENC_NA); *pOffset+=GUID_LEN;
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, GUID_LEN, ENC_NA);
+ *pOffset+=GUID_LEN;
+ return item;
}
-void parseByteString(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseByteString(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
+ proto_item *item = NULL;
char *szValue;
int iOffset = *pOffset;
gint32 iLen = tvb_get_letohl(tvb, iOffset);
if (iLen == -1)
{
- proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
+ item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
proto_item_append_text(item, "[OpcUa Null ByteString]");
proto_item_set_end(item, tvb, *pOffset + 4);
}
else if (iLen == 0)
{
- proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
+ item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
proto_item_append_text(item, "[OpcUa Empty ByteString]");
proto_item_set_end(item, tvb, *pOffset + 4);
}
else if (iLen > 0)
{
- proto_tree_add_item(tree, hfIndex, tvb, iOffset, iLen, ENC_NA);
+ item = proto_tree_add_item(tree, hfIndex, tvb, iOffset, iLen, ENC_NA);
iOffset += iLen; /* eat the whole bytestring */
}
else
{
- proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
+ item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, 0, ENC_NA);
szValue = wmem_strdup_printf(wmem_packet_scope(), "[Invalid ByteString] Invalid length: %d", iLen);
proto_item_append_text(item, "%s", szValue);
proto_item_set_end(item, tvb, *pOffset + 4);
}
*pOffset = iOffset;
+ return item;
}
-void parseXmlElement(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseXmlElement(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- parseByteString(tree, tvb, pOffset, hfIndex);
+ return parseByteString(tree, tvb, pOffset, hfIndex);
}
-void parseFloat(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseFloat(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, (int)sizeof(gfloat), ENC_LITTLE_ENDIAN);
- *pOffset += (int)sizeof(gfloat);
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, (int)sizeof(gfloat), ENC_LITTLE_ENDIAN);
+ *pOffset += (int)sizeof(gfloat);
+ return item;
}
-void parseDouble(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseDouble(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- proto_tree_add_item(tree, hfIndex, tvb, *pOffset, (int)sizeof(gdouble), ENC_LITTLE_ENDIAN);
- *pOffset += (int)sizeof(gdouble);
+ proto_item *item = proto_tree_add_item(tree, hfIndex, tvb, *pOffset, (int)sizeof(gdouble), ENC_LITTLE_ENDIAN);
+ *pOffset += (int)sizeof(gdouble);
+ return item;
}
-void parseDateTime(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
+proto_item* parseDateTime(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex)
{
- *pOffset = dissect_nt_64bit_time(tvb, tree, *pOffset, hfIndex);
+ proto_item *item = NULL;
+ *pOffset = dissect_nt_64bit_time_ex(tvb, tree, *pOffset, hfIndex, &item);
+ return item;
}
void parseDiagnosticInfo(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
proto_item *ti;
proto_item *ti_inner;
- ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "%s: DiagnosticInfo", szFieldName);
- subtree = proto_item_add_subtree(ti, ett_opcua_diagnosticinfo);
+ subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_diagnosticinfo, &ti, "%s: DiagnosticInfo", szFieldName);
/* parse encoding mask */
EncodingMask = tvb_get_guint8(tvb, iOffset);
ti_inner = proto_tree_add_text(subtree, tvb, iOffset, 1, "EncodingMask");
- mask_tree = proto_item_add_subtree(ti_inner, ett_opcua_diagnosticinfo);
+ mask_tree = proto_item_add_subtree(ti_inner, ett_opcua_diagnosticinfo_encodingmask);
proto_tree_add_item(mask_tree, hf_opcua_diag_mask_symbolicflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(mask_tree, hf_opcua_diag_mask_namespaceflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(mask_tree, hf_opcua_diag_mask_localizedtextflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
+ proto_tree_add_item(mask_tree, hf_opcua_diag_mask_localeflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(mask_tree, hf_opcua_diag_mask_additionalinfoflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(mask_tree, hf_opcua_diag_mask_innerstatuscodeflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(mask_tree, hf_opcua_diag_mask_innerdiaginfoflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
{
parseInt32(subtree, tvb, &iOffset, hf_opcua_diag_localizedtext);
}
+ if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_LOCALE_FLAG)
+ {
+ parseInt32(subtree, tvb, &iOffset, hf_opcua_diag_locale);
+ }
if (EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_ADDITIONALINFO_FLAG)
{
parseString(subtree, tvb, &iOffset, hf_opcua_diag_additionalinfo);
void parseQualifiedName(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
{
- proto_item *ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "%s: QualifiedName", szFieldName);
- proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_qualifiedname);
+ proto_item *ti;
+ proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1,
+ ett_opcua_qualifiedname, &ti, "%s: QualifiedName", szFieldName);
parseUInt16(subtree, tvb, pOffset, hf_opcua_qualifiedname_id);
parseString(subtree, tvb, pOffset, hf_opcua_qualifiedname_name);
void parseDataValue(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
{
- proto_item *ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "%s: DataValue", szFieldName);
- proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_datavalue);
+ proto_item *ti;
+ proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1,
+ ett_opcua_datavalue, &ti, "%s: DataValue", szFieldName);
proto_tree *mask_tree;
gint iOffset = *pOffset;
guint8 EncodingMask;
EncodingMask = tvb_get_guint8(tvb, iOffset);
ti_inner = proto_tree_add_text(subtree, tvb, iOffset, 1, "EncodingMask");
- mask_tree = proto_item_add_subtree(ti_inner, ett_opcua_datavalue);
+ mask_tree = proto_item_add_subtree(ti_inner, ett_opcua_datavalue_encodingmask);
proto_tree_add_item(mask_tree, hf_opcua_datavalue_mask_valueflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(mask_tree, hf_opcua_datavalue_mask_statuscodeflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(mask_tree, hf_opcua_datavalue_mask_sourcetimestampflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
void parseVariant(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
{
- proto_item *ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "%s: Variant", szFieldName);
- proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_variant);
+ proto_item *ti;
+ proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1,
+ ett_opcua_variant, &ti, "%s: Variant", szFieldName);
gint iOffset = *pOffset;
guint8 EncodingMask;
gint32 ArrayDimensions = 0;
switch(EncodingMask & 0x3f)
{
case OpcUaType_Null: break;
- case OpcUaType_Boolean: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Boolean, parseBoolean); break;
- case OpcUaType_SByte: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_SByte, parseSByte); break;
- case OpcUaType_Byte: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Byte, parseByte); break;
- case OpcUaType_Int16: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Int16, parseInt16); break;
- case OpcUaType_UInt16: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_UInt16, parseUInt16); break;
- case OpcUaType_Int32: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Int32, parseInt32); break;
- case OpcUaType_UInt32: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_UInt32, parseUInt32); break;
- case OpcUaType_Int64: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Int64, parseInt64); break;
- case OpcUaType_UInt64: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_UInt64, parseUInt64); break;
- case OpcUaType_Float: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Float, parseFloat); break;
- case OpcUaType_Double: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Double, parseDouble); break;
- case OpcUaType_String: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_String, parseString); break;
- case OpcUaType_DateTime: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_DateTime, parseDateTime); break;
- case OpcUaType_Guid: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_Guid, parseGuid); break;
- case OpcUaType_ByteString: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_ByteString, parseByteString); break;
- case OpcUaType_XmlElement: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_XmlElement, parseXmlElement); break;
- case OpcUaType_NodeId: parseArrayComplex(subtree, tvb, &iOffset, "NodeId", parseNodeId); break;
- case OpcUaType_ExpandedNodeId: parseArrayComplex(subtree, tvb, &iOffset, "ExpandedNodeId", parseExpandedNodeId); break;
- case OpcUaType_StatusCode: parseArraySimple(subtree, tvb, &iOffset, hf_opcua_StatusCode, parseStatusCode); break;
- case OpcUaType_DiagnosticInfo: parseArrayComplex(subtree, tvb, &iOffset, "DiagnosticInfo", parseDiagnosticInfo); break;
- case OpcUaType_QualifiedName: parseArrayComplex(subtree, tvb, &iOffset, "QualifiedName", parseQualifiedName); break;
- case OpcUaType_LocalizedText: parseArrayComplex(subtree, tvb, &iOffset, "LocalizedText", parseLocalizedText); break;
- case OpcUaType_ExtensionObject: parseArrayComplex(subtree, tvb, &iOffset, "ExtensionObject", parseExtensionObject); break;
- case OpcUaType_DataValue: parseArrayComplex(subtree, tvb, &iOffset, "DataValue", parseDataValue); break;
- case OpcUaType_Variant: parseArrayComplex(subtree, tvb, &iOffset, "Variant", parseVariant); break;
+ case OpcUaType_Boolean: parseArraySimple(subtree, tvb, &iOffset, "Boolean", "Boolean", hf_opcua_Boolean, parseBoolean, ett_opcua_array_Boolean); break;
+ case OpcUaType_SByte: parseArraySimple(subtree, tvb, &iOffset, "SByte", "SByte", hf_opcua_SByte, parseSByte, ett_opcua_array_SByte); break;
+ case OpcUaType_Byte: parseArraySimple(subtree, tvb, &iOffset, "Byte", "Byte", hf_opcua_Byte, parseByte, ett_opcua_array_Byte); break;
+ case OpcUaType_Int16: parseArraySimple(subtree, tvb, &iOffset, "Int16", "Int16", hf_opcua_Int16, parseInt16, ett_opcua_array_Int16); break;
+ case OpcUaType_UInt16: parseArraySimple(subtree, tvb, &iOffset, "UInt16", "UInt16", hf_opcua_UInt16, parseUInt16, ett_opcua_array_UInt16); break;
+ case OpcUaType_Int32: parseArraySimple(subtree, tvb, &iOffset, "Int32", "Int32", hf_opcua_Int32, parseInt32, ett_opcua_array_Int32); break;
+ case OpcUaType_UInt32: parseArraySimple(subtree, tvb, &iOffset, "UInt32", "UInt32", hf_opcua_UInt32, parseUInt32, ett_opcua_array_UInt32); break;
+ case OpcUaType_Int64: parseArraySimple(subtree, tvb, &iOffset, "Int64", "Int64", hf_opcua_Int64, parseInt64, ett_opcua_array_Int64); break;
+ case OpcUaType_UInt64: parseArraySimple(subtree, tvb, &iOffset, "UInt64", "UInt64", hf_opcua_UInt64, parseUInt64, ett_opcua_array_UInt64); break;
+ case OpcUaType_Float: parseArraySimple(subtree, tvb, &iOffset, "Float", "Float", hf_opcua_Float, parseFloat, ett_opcua_array_Float); break;
+ case OpcUaType_Double: parseArraySimple(subtree, tvb, &iOffset, "Double", "Double", hf_opcua_Double, parseDouble, ett_opcua_array_Double); break;
+ case OpcUaType_String: parseArraySimple(subtree, tvb, &iOffset, "String", "String", hf_opcua_String, parseString, ett_opcua_array_String); break;
+ case OpcUaType_DateTime: parseArraySimple(subtree, tvb, &iOffset, "DateTime", "DateTime", hf_opcua_DateTime, parseDateTime, ett_opcua_array_DateTime); break;
+ case OpcUaType_Guid: parseArraySimple(subtree, tvb, &iOffset, "Guid", "Guid", hf_opcua_Guid, parseGuid, ett_opcua_array_Guid); break;
+ case OpcUaType_ByteString: parseArraySimple(subtree, tvb, &iOffset, "ByteString", "ByteString", hf_opcua_ByteString, parseByteString, ett_opcua_array_ByteString); break;
+ case OpcUaType_XmlElement: parseArraySimple(subtree, tvb, &iOffset, "XmlElement", "XmlElement", hf_opcua_XmlElement, parseXmlElement, ett_opcua_array_XmlElement); break;
+ case OpcUaType_NodeId: parseArrayComplex(subtree, tvb, &iOffset, "NodeId", "NodeId", parseNodeId, ett_opcua_array_NodeId); break;
+ case OpcUaType_ExpandedNodeId: parseArrayComplex(subtree, tvb, &iOffset, "ExpandedNodeId", "ExpandedNodeId", parseExpandedNodeId, ett_opcua_array_ExpandedNodeId); break;
+ case OpcUaType_StatusCode: parseArraySimple(subtree, tvb, &iOffset, "StatusCode", "StatusCode", hf_opcua_StatusCode, parseStatusCode, ett_opcua_array_StatusCode); break;
+ case OpcUaType_DiagnosticInfo: parseArrayComplex(subtree, tvb, &iOffset, "DiagnosticInfo", "DiagnosticInfo", parseDiagnosticInfo, ett_opcua_array_DiagnosticInfo); break;
+ case OpcUaType_QualifiedName: parseArrayComplex(subtree, tvb, &iOffset, "QualifiedName", "QualifiedName", parseQualifiedName, ett_opcua_array_QualifiedName); break;
+ case OpcUaType_LocalizedText: parseArrayComplex(subtree, tvb, &iOffset, "LocalizedText", "LocalizedText", parseLocalizedText, ett_opcua_array_LocalizedText); break;
+ case OpcUaType_ExtensionObject: parseArrayComplex(subtree, tvb, &iOffset, "ExtensionObject", "ExtensionObject", parseExtensionObject, ett_opcua_array_ExtensionObject); break;
+ case OpcUaType_DataValue: parseArrayComplex(subtree, tvb, &iOffset, "DataValue", "DataValue", parseDataValue, ett_opcua_array_DataValue); break;
+ case OpcUaType_Variant: parseArrayComplex(subtree, tvb, &iOffset, "Variant", "Variant", parseVariant, ett_opcua_array_Variant); break;
}
if (EncodingMask & VARIANT_ARRAYDIMENSIONS)
{
- proto_item *ti_2 = proto_tree_add_text(subtree, tvb, iOffset, -1, "ArrayDimensions");
- proto_tree *subtree_2 = proto_item_add_subtree(ti_2, ett_opcua_array);
+ proto_item *ti_2;
+ proto_tree *subtree_2 = proto_tree_add_subtree(subtree, tvb, iOffset, -1,
+ ett_opcua_variant_arraydims, &ti_2, "ArrayDimensions");
int i;
/* read array length */
* All arrays have one 4 byte signed integer length information,
* followed by n data elements.
*/
-void parseArraySimple(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex, fctSimpleTypeParser pParserFunction)
+void parseArraySimple(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName, const char *szTypeName, int hfIndex, fctSimpleTypeParser pParserFunction, const gint idx)
{
- static const char szFieldName[] = "Array of Simple Type";
- proto_item *ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "%s", szFieldName);
- proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_array);
+ proto_item *ti;
+ proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, idx, &ti, "%s: Array of %s", szFieldName, szTypeName);
int i;
gint32 iLen;
*pOffset += 4;
for (i=0; i<iLen; i++)
{
- (*pParserFunction)(subtree, tvb, pOffset, hfIndex);
+ proto_item *arrayItem = (*pParserFunction)(subtree, tvb, pOffset, hfIndex);
+ if (arrayItem != NULL)
+ {
+ proto_item_prepend_text(arrayItem, "[%i]: ", i);
+ }
}
proto_item_set_end(ti, tvb, *pOffset);
}
* All arrays have one 4 byte signed integer length information,
* followed by n data elements.
*/
-void parseArrayEnum(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, fctEnumParser pParserFunction)
+void parseArrayEnum(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName, const char *szTypeName, fctEnumParser pParserFunction, const gint idx)
{
- static const char szFieldName[] = "Array of Enum Type";
- proto_item *ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "%s", szFieldName);
- proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_array);
+ proto_item *ti;
+ proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, idx, &ti, "%s: Array of %s", szFieldName, szTypeName);
int i;
gint32 iLen;
* All arrays have one 4 byte signed integer length information,
* followed by n data elements.
*/
-void parseArrayComplex(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName, fctComplexTypeParser pParserFunction)
+void parseArrayComplex(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName, const char *szTypeName, fctComplexTypeParser pParserFunction, const gint idx)
{
- proto_item *ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "Array of %s", szFieldName);
- proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_array);
+ proto_item *ti;
+ proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, idx, &ti, "%s: Array of %s", szFieldName, szTypeName);
int i;
gint32 iLen;
void parseNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
{
- proto_item *ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "%s: NodeId", szFieldName);
- proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_nodeid);
+ proto_item *ti;
+ proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_nodeid, &ti, "%s: NodeId", szFieldName);
gint iOffset = *pOffset;
guint8 EncodingMask;
proto_item *ti_inner;
/* add extension object subtree */
- ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "%s : ExtensionObject", szFieldName);
- extobj_tree = proto_item_add_subtree(ti, ett_opcua_extensionobject);
+ extobj_tree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_extensionobject, &ti, "%s: ExtensionObject", szFieldName);
/* add nodeid subtree */
TypeId = getExtensionObjectType(tvb, &iOffset);
/* parse encoding mask */
EncodingMask = tvb_get_guint8(tvb, iOffset);
ti_inner = proto_tree_add_text(extobj_tree, tvb, iOffset, 1, "EncodingMask");
- mask_tree = proto_item_add_subtree(ti_inner, ett_opcua_extobj_encodingmask);
+ mask_tree = proto_item_add_subtree(ti_inner, ett_opcua_extensionobject_encodingmask);
proto_tree_add_item(mask_tree, hf_opcua_extobj_mask_binbodyflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(mask_tree, hf_opcua_extobj_mask_xmlbodyflag, tvb, iOffset, 1, ENC_LITTLE_ENDIAN);
iOffset++;
void parseExpandedNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const char *szFieldName)
{
- proto_item *ti = proto_tree_add_text(tree, tvb, *pOffset, -1, "%s: ExpandedNodeId", szFieldName);
- proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_nodeid);
+ proto_item *ti;
+ proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1,
+ ett_opcua_expandednodeid, &ti, "%s: ExpandedNodeId", szFieldName);
gint iOffset = *pOffset;
guint8 EncodingMask;