From e1ed17f9271eb9932c5980d7ced23e6eca13c691 Mon Sep 17 00:00:00 2001 From: Hannes Mezger Date: Tue, 27 Oct 2015 14:36:10 +0100 Subject: opcua: display string representation of AttributeId and DeadbandType Change-Id: I41f100ddab544054f8fab89f3f5da61866db7a2d Reviewed-on: https://code.wireshark.org/review/11309 Reviewed-by: Alexis La Goutte Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- plugins/opcua/opcua_complextypeparser.c | 12 +++++------ plugins/opcua/opcua_enumparser.c | 35 +++++++++++++++++++++++++++++++++ plugins/opcua/opcua_enumparser.h | 2 ++ plugins/opcua/opcua_hfindeces.c | 2 -- plugins/opcua/opcua_hfindeces.h | 1 - 5 files changed, 43 insertions(+), 9 deletions(-) (limited to 'plugins/opcua') diff --git a/plugins/opcua/opcua_complextypeparser.c b/plugins/opcua/opcua_complextypeparser.c index e29197b5a4..c1b0814b71 100644 --- a/plugins/opcua/opcua_complextypeparser.c +++ b/plugins/opcua/opcua_complextypeparser.c @@ -1049,7 +1049,7 @@ void parseQueryDataDescription(proto_tree *tree, tvbuff_t *tvb, packet_info *pin proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_QueryDataDescription, &ti, "%s: QueryDataDescription", szFieldName); parseRelativePath(subtree, tvb, pinfo, pOffset, "RelativePath"); - parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_AttributeId); + parseAttributeId(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IndexRange); proto_item_set_end(ti, tvb, *pOffset); } @@ -1122,7 +1122,7 @@ void parseAttributeOperand(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_Alias); parseRelativePath(subtree, tvb, pinfo, pOffset, "BrowsePath"); - parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_AttributeId); + parseAttributeId(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IndexRange); proto_item_set_end(ti, tvb, *pOffset); } @@ -1133,7 +1133,7 @@ void parseSimpleAttributeOperand(proto_tree *tree, tvbuff_t *tvb, packet_info *p parseNodeId(subtree, tvb, pinfo, pOffset, "TypeDefinitionId"); /* Array length field ignored: NoOfBrowsePath */ parseArrayComplex(subtree, tvb, pinfo, pOffset, "BrowsePath", "QualifiedName", parseQualifiedName, ett_opcua_array_QualifiedName); - parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_AttributeId); + parseAttributeId(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IndexRange); proto_item_set_end(ti, tvb, *pOffset); } @@ -1174,7 +1174,7 @@ void parseReadValueId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_ReadValueId, &ti, "%s: ReadValueId", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); - parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_AttributeId); + parseAttributeId(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IndexRange); parseQualifiedName(subtree, tvb, pinfo, pOffset, "DataEncoding"); proto_item_set_end(ti, tvb, *pOffset); @@ -1280,7 +1280,7 @@ void parseWriteValue(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint * proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_WriteValue, &ti, "%s: WriteValue", szFieldName); parseNodeId(subtree, tvb, pinfo, pOffset, "NodeId"); - parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_AttributeId); + parseAttributeId(subtree, tvb, pinfo, pOffset); parseString(subtree, tvb, pinfo, pOffset, hf_opcua_IndexRange); parseDataValue(subtree, tvb, pinfo, pOffset, "Value"); proto_item_set_end(ti, tvb, *pOffset); @@ -1390,7 +1390,7 @@ void parseDataChangeFilter(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, proto_item *ti; proto_tree *subtree = proto_tree_add_subtree_format(tree, tvb, *pOffset, -1, ett_opcua_DataChangeFilter, &ti, "%s: DataChangeFilter", szFieldName); parseDataChangeTrigger(subtree, tvb, pinfo, pOffset); - parseUInt32(subtree, tvb, pinfo, pOffset, hf_opcua_DeadbandType); + parseDeadbandType(subtree, tvb, pinfo, pOffset); parseDouble(subtree, tvb, pinfo, pOffset, hf_opcua_DeadbandValue); proto_item_set_end(ti, tvb, *pOffset); } diff --git a/plugins/opcua/opcua_enumparser.c b/plugins/opcua/opcua_enumparser.c index c08b2fad85..f2467ecd3f 100644 --- a/plugins/opcua/opcua_enumparser.c +++ b/plugins/opcua/opcua_enumparser.c @@ -522,6 +522,38 @@ void parseExceptionDeviationFormat(proto_tree *tree, tvbuff_t *tvb, packet_info { proto_tree_add_item(tree, hf_opcua_ExceptionDeviationFormat, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4; } +/** AttributeId enum table */ +static const value_string g_AttributeIdTable[] = { + {1, "NodeId"}, + {2, "NodeClass"}, + {3, "BrowseName"}, + {4, "DisplayName"}, + {5, "Description"}, + {6, "WriteMask"}, + {7, "UserWriteMask"}, + {8, "IsAbstract"}, + {9, "Symmetric"}, + {10, "InverseName"}, + {11, "ContainsNoLoops"}, + {12, "EventNotifier"}, + {13, "Value"}, + {14, "DataType"}, + {15, "ValueRank"}, + {16, "ArrayDimensions"}, + {17, "AccessLevel"}, + {18, "UserAccessLevel"}, + {19, "MinimumSamplingInterval"}, + {20, "Historizing"}, + {21, "Executable"}, + {22, "UserExecutable"}, + {0, NULL} +}; +static int hf_opcua_AttributeId = -1; + +void parseAttributeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset) +{ + proto_tree_add_item(tree, hf_opcua_AttributeId, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset += 4; +} /** Setup enum subtree array */ static gint *ett[] = @@ -646,6 +678,9 @@ void registerEnumTypes(int proto) { &hf_opcua_ExceptionDeviationFormat, { "ExceptionDeviationFormat", "opcua.ExceptionDeviationFormat", FT_UINT32, BASE_HEX, VALS(g_ExceptionDeviationFormatTable), 0x0, NULL, HFILL } }, + { &hf_opcua_AttributeId, + { "AttributeId", "opcua.AttributeId", FT_UINT32, BASE_HEX, VALS(g_AttributeIdTable), 0x0, NULL, HFILL } + }, }; proto_register_field_array(proto, hf, array_length(hf)); diff --git a/plugins/opcua/opcua_enumparser.h b/plugins/opcua/opcua_enumparser.h index bc10bb65e1..56360a839d 100644 --- a/plugins/opcua/opcua_enumparser.h +++ b/plugins/opcua/opcua_enumparser.h @@ -51,6 +51,7 @@ extern gint ett_opcua_array_ServerState; extern gint ett_opcua_array_ModelChangeStructureVerbMask; extern gint ett_opcua_array_AxisScaleEnumeration; extern gint ett_opcua_array_ExceptionDeviationFormat; +extern gint ett_opcua_array_AttributeId; void parseNodeIdType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseNamingRuleType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); @@ -80,4 +81,5 @@ void parseServerState(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint void parseModelChangeStructureVerbMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseAxisScaleEnumeration(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void parseExceptionDeviationFormat(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); +void parseAttributeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset); void registerEnumTypes(int proto); diff --git a/plugins/opcua/opcua_hfindeces.c b/plugins/opcua/opcua_hfindeces.c index 46e5ad0cce..07d1fb0409 100644 --- a/plugins/opcua/opcua_hfindeces.c +++ b/plugins/opcua/opcua_hfindeces.c @@ -33,7 +33,6 @@ int hf_opcua_Alias = -1; int hf_opcua_AnnotationTime = -1; int hf_opcua_ApplicationUri = -1; int hf_opcua_ArrayDimensions = -1; -int hf_opcua_AttributeId = -1; int hf_opcua_AuditEntryId = -1; int hf_opcua_AuthenticationMechanism = -1; int hf_opcua_AvailableSequenceNumbers = -1; @@ -339,7 +338,6 @@ void registerFieldTypes(int proto) { &hf_opcua_AnnotationTime, { "AnnotationTime", "opcua.AnnotationTime", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ApplicationUri, { "ApplicationUri", "opcua.ApplicationUri", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_ArrayDimensions, { "ArrayDimensions", "opcua.ArrayDimensions", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, - { &hf_opcua_AttributeId, { "AttributeId", "opcua.AttributeId", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_AuditEntryId, { "AuditEntryId", "opcua.AuditEntryId", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_AuthenticationMechanism, { "AuthenticationMechanism", "opcua.AuthenticationMechanism", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_AvailableSequenceNumbers, { "AvailableSequenceNumbers", "opcua.AvailableSequenceNumbers", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, diff --git a/plugins/opcua/opcua_hfindeces.h b/plugins/opcua/opcua_hfindeces.h index 98ee275b74..913636e4a3 100644 --- a/plugins/opcua/opcua_hfindeces.h +++ b/plugins/opcua/opcua_hfindeces.h @@ -31,7 +31,6 @@ extern int hf_opcua_Alias; extern int hf_opcua_AnnotationTime; extern int hf_opcua_ApplicationUri; extern int hf_opcua_ArrayDimensions; -extern int hf_opcua_AttributeId; extern int hf_opcua_AuditEntryId; extern int hf_opcua_AuthenticationMechanism; extern int hf_opcua_AvailableSequenceNumbers; -- cgit v1.2.1