From e2ae387d9c9d2d38d1da788f39b8e65a22fff8dd Mon Sep 17 00:00:00 2001 From: Hannes Mezger Date: Tue, 10 Jun 2014 11:46:05 +0200 Subject: Fix NodeId and ExpandedNodeId encoding mask display There are no 'URI' NodeIds, removed this option and changed GUID/Opaque to their correct values as stated in the UA specification. Change-Id: Ibf9afdbd72f8ad336f5eb83ece5adbcce51e8365 Reviewed-on: https://code.wireshark.org/review/2122 Reviewed-by: Alexis La Goutte --- plugins/opcua/opcua_application_layer.c | 19 ++++++++----------- plugins/opcua/opcua_simpletypes.c | 20 ++++++++++++-------- 2 files changed, 20 insertions(+), 19 deletions(-) (limited to 'plugins') diff --git a/plugins/opcua/opcua_application_layer.c b/plugins/opcua/opcua_application_layer.c index 28920ae5a1..1c29778942 100644 --- a/plugins/opcua/opcua_application_layer.c +++ b/plugins/opcua/opcua_application_layer.c @@ -28,14 +28,12 @@ /** NodeId encoding mask table */ static const value_string g_nodeidmasks[] = { - { 0, "Two byte encoded Numeric" }, - { 1, "Four byte encoded Numeric" }, - { 2, "Numeric of arbitrary length" }, - { 3, "String" }, - { 4, "URI" }, - { 5, "GUID" }, - { 6, "Opaque" }, - { 0x80, "UriMask" }, + { 0x00, "Two byte encoded Numeric" }, + { 0x01, "Four byte encoded Numeric" }, + { 0x02, "Numeric of arbitrary length" }, + { 0x03, "String" }, + { 0x04, "GUID" }, + { 0x05, "Opaque" }, { 0, NULL } }; @@ -101,9 +99,8 @@ int parseServiceNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) iOffset+=4; break; case 0x03: /* string */ - case 0x04: /* uri */ - case 0x05: /* guid */ - case 0x06: /* byte string */ + case 0x04: /* guid */ + case 0x05: /* opaque*/ /* NOT USED */ break; }; diff --git a/plugins/opcua/opcua_simpletypes.c b/plugins/opcua/opcua_simpletypes.c index f02cf50b4f..9620a343a9 100644 --- a/plugins/opcua/opcua_simpletypes.c +++ b/plugins/opcua/opcua_simpletypes.c @@ -67,6 +67,8 @@ static int hf_opcua_datavalue_mask_servertimestampflag = -1; static int hf_opcua_datavalue_mask_sourcepicoseconds = -1; static int hf_opcua_datavalue_mask_serverpicoseconds = -1; static int hf_opcua_nodeid_encodingmask = -1; +static int hf_opcua_expandednodeid_mask_namespaceuri = -1; +static int hf_opcua_expandednodeid_mask_serverindex = -1; static int hf_opcua_variant_encodingmask = -1; static int hf_opcua_nodeid_nsindex = -1; static int hf_opcua_nodeid_numeric = -1; @@ -91,14 +93,12 @@ static int hf_opcua_ServerIndex = -1; /** NodeId encoding mask table */ static const value_string g_nodeidmasks[] = { - { 0, "Two byte encoded Numeric" }, - { 1, "Four byte encoded Numeric" }, - { 2, "Numeric of arbitrary length" }, - { 3, "String" }, - { 4, "URI" }, - { 5, "GUID" }, - { 6, "Opaque" }, - { 0x80, "UriMask" }, + { 0x00, "Two byte encoded Numeric" }, + { 0x01, "Four byte encoded Numeric" }, + { 0x02, "Numeric of arbitrary length" }, + { 0x03, "String" }, + { 0x04, "GUID" }, + { 0x05, "Opaque" }, { 0, NULL } }; @@ -282,6 +282,8 @@ void registerSimpleTypes(int proto) { &hf_opcua_nodeid_numeric, { "NodeId Identifier Numeric", "application.nodeid.numeric", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_opcua_expandednodeid_mask_namespaceuri, { "has namespace uri", "opcua.has_namespace_uri", FT_BOOLEAN, 8, NULL, NODEID_NAMESPACEURIFLAG, NULL, HFILL } }, + { &hf_opcua_expandednodeid_mask_serverindex, { "has server index", "opcua.has_server_index", FT_BOOLEAN, 8, NULL, NODEID_SERVERINDEXFLAG, NULL, HFILL } }, { &hf_opcua_localizedtext_locale, { "Locale", "opcua.Locale", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_localizedtext_text, { "Text", "opcua.Text", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_opcua_qualifiedname_id, { "Id", "opcua.Id", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, @@ -908,6 +910,8 @@ void parseExpandedNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, const c EncodingMask = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_encodingmask, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(subtree, hf_opcua_expandednodeid_mask_namespaceuri, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); + proto_tree_add_item(subtree, hf_opcua_expandednodeid_mask_serverindex, tvb, iOffset, 1, ENC_LITTLE_ENDIAN); iOffset++; switch(EncodingMask & 0x0F) -- cgit v1.2.3