Wireshark-dev: [Wireshark-dev] OpcUa update
From: Gerhard Gappmeier <gerhard.gappmeier@xxxxxxxxxxx>
Date: Tue, 15 May 2007 11:13:22 +0200
Hi, I removed the unused variables and renamed the files with "ua_" prefix to "opcua_" to be consistent. I hope renaming works with the patch file... regards, Gerhard.
Index: Makefile.common =================================================================== --- Makefile.common (revision 21777) +++ Makefile.common (working copy) @@ -30,9 +30,9 @@ # the dissector sources (without any helpers) DISSECTOR_SRC = \ opcua.c \ - ua_transport_layer.c \ - ua_security_layer.c \ - ua_application_layer.c \ + opcua_transport_layer.c \ + opcua_security_layer.c \ + opcua_application_layer.c \ opcua_serviceparser.c \ opcua_complextypeparser.c \ opcua_enumparser.c \ Index: opcua.c =================================================================== --- opcua.c (revision 21777) +++ opcua.c (working copy) @@ -30,9 +30,9 @@ #include <epan/emem.h> #include <epan/dissectors/packet-tcp.h> #include <epan/prefs.h> -#include "ua_transport_layer.h" -#include "ua_security_layer.h" -#include "ua_application_layer.h" +#include "opcua_transport_layer.h" +#include "opcua_security_layer.h" +#include "opcua_application_layer.h" #include "opcua_complextypeparser.h" #include "opcua_serviceparser.h" #include "opcua_enumparser.h" Index: opcua_application_layer.c =================================================================== --- opcua_application_layer.c (revision 21777) +++ opcua_application_layer.c (working copy) @@ -75,7 +75,7 @@ int parseServiceNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, char *szFieldName) { gint iOffset = *pOffset; - guint8 EncodingMask, NSId = 0; + guint8 EncodingMask; guint32 Numeric = 0; szFieldName = 0; /* avoid warning */ @@ -92,7 +92,6 @@ iOffset+=1; break; case 0x01: /* four byte node id */ - NSId = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(tree, hf_opcua_app_nsid, tvb, iOffset, 1, TRUE); iOffset+=1; Numeric = tvb_get_letohs(tvb, iOffset); @@ -100,7 +99,6 @@ iOffset+=2; break; case 0x02: /* numeric, that does not fit into four bytes */ - NSId = tvb_get_letohl(tvb, iOffset); proto_tree_add_item(tree, hf_opcua_app_nsid, tvb, iOffset, 4, TRUE); iOffset+=4; Numeric = tvb_get_letohl(tvb, iOffset); Index: opcua_security_layer.c =================================================================== --- opcua_security_layer.c (revision 21777) +++ opcua_security_layer.c (working copy) @@ -27,7 +27,7 @@ #include <gmodule.h> #include <epan/packet.h> -#include "ua_application_layer.h" +#include "opcua_application_layer.h" #include "opcua_simpletypes.h" /** NodeClass enum table */ Index: opcua_simpletypes.c =================================================================== --- opcua_simpletypes.c (revision 21777) +++ opcua_simpletypes.c (working copy) @@ -693,7 +693,6 @@ proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_nodeid); gint iOffset = *pOffset; guint8 EncodingMask; - guint32 Numeric = 0, NSId = 0; EncodingMask = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_encodingmask, tvb, iOffset, 1, TRUE); @@ -702,28 +701,22 @@ switch(EncodingMask) { case 0x00: /* two byte node id */ - Numeric = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 1, TRUE); iOffset+=1; break; case 0x01: /* four byte node id */ - NSId = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 1, TRUE); iOffset+=1; - Numeric = tvb_get_letohs(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 2, TRUE); iOffset+=2; break; case 0x02: /* numeric, that does not fit into four bytes */ - NSId = tvb_get_letohl(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 4, TRUE); iOffset+=4; - Numeric = tvb_get_letohl(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 4, TRUE); iOffset+=4; break; case 0x03: /* string */ - NSId = tvb_get_letohl(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 4, TRUE); iOffset+=4; parseString(subtree, tvb, &iOffset, hf_opcua_String); @@ -735,7 +728,6 @@ parseGuid(subtree, tvb, &iOffset, hf_opcua_Guid); break; case 0x06: /* byte string */ - NSId = tvb_get_letohl(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 4, TRUE); iOffset+=4; parseByteString(subtree, tvb, &iOffset, hf_opcua_ByteString); @@ -781,8 +773,7 @@ proto_item *ti = proto_tree_add_text(tree, tvb, 0, -1, "%s: ExpandedNodeId", szFieldName); proto_tree *subtree = proto_item_add_subtree(ti, ett_opcua_nodeid); gint iOffset = *pOffset; - guint8 EncodingMask, NSId = 0; - guint32 Numeric = 0; + guint8 EncodingMask; EncodingMask = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_encodingmask, tvb, iOffset, 1, TRUE); @@ -791,28 +782,22 @@ switch(EncodingMask) { case 0x00: /* two byte node id */ - Numeric = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 1, TRUE); iOffset+=1; break; case 0x01: /* four byte node id */ - NSId = tvb_get_guint8(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 1, TRUE); iOffset+=1; - Numeric = tvb_get_letohs(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 2, TRUE); iOffset+=2; break; case 0x02: /* numeric, that does not fit into four bytes */ - NSId = tvb_get_letohl(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 4, TRUE); iOffset+=4; - Numeric = tvb_get_letohl(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_numeric, tvb, iOffset, 4, TRUE); iOffset+=4; break; case 0x03: /* string */ - NSId = tvb_get_letohl(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 4, TRUE); iOffset+=4; parseString(subtree, tvb, &iOffset, hf_opcua_String); @@ -824,7 +809,6 @@ parseGuid(subtree, tvb, &iOffset, hf_opcua_Guid); break; case 0x06: /* byte string */ - NSId = tvb_get_letohl(tvb, iOffset); proto_tree_add_item(subtree, hf_opcua_nodeid_nsid, tvb, iOffset, 4, TRUE); iOffset+=4; parseByteString(subtree, tvb, &iOffset, hf_opcua_ByteString); Index: opcua_transport_layer.c =================================================================== --- opcua_transport_layer.c (revision 21777) +++ opcua_transport_layer.c (working copy) @@ -27,8 +27,8 @@ #include <gmodule.h> #include <epan/packet.h> -#include "ua_security_layer.h" -#include "ua_application_layer.h" +#include "opcua_security_layer.h" +#include "opcua_application_layer.h" #include "opcua_simpletypes.h" #include <string.h> #include <epan/emem.h> Index: ua_application_layer.c =================================================================== --- ua_application_layer.c (revision 21777) +++ ua_application_layer.c (working copy) @@ -1,122 +0,0 @@ -/****************************************************************************** -** $Id: ua_application_layer.c,v 1.3 2007/02/08 11:31:56 gergap Exp $ -** -** Copyright (C) 2006-2007 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: OpcUa Application Layer Decoder. -** -** Author: Gerhard Gappmeier <gerhard.gappmeier@xxxxxxxxxxx> -** Last change by: $Author: gergap $ -** -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gmodule.h> -#include <epan/packet.h> -#include "opcua_simpletypes.h" - -/** 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, "ByteString" }, - { 0x80, "UriMask" }, - { 0, NULL } -}; - -/** Service type table */ -extern const value_string g_requesttypes[]; - -static int hf_opcua_nodeid_encodingmask = -1; -static int hf_opcua_app_nsid = -1; -static int hf_opcua_app_numeric = -1; - -/** header field definitions */ -static hf_register_info hf[] = -{ - { &hf_opcua_nodeid_encodingmask, - { "NodeId EncodingMask", "application.nodeid.encodingmask", FT_UINT8, BASE_HEX, VALS(g_nodeidmasks), 0x0, "", HFILL } - }, - { &hf_opcua_app_nsid, - { "NodeId EncodingMask", "application.nodeid.nsid", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_app_numeric, - { "NodeId Identifier Numeric", "application.nodeid.numeric", FT_UINT32, BASE_DEC, VALS(g_requesttypes), 0x0, "", HFILL } - } -}; - -/** Register application layer types. */ -void registerApplicationLayerTypes(int proto) -{ - proto_register_field_array(proto, hf, array_length(hf)); -} - -/** Parses an OpcUa Service NodeId and returns the service type. - * In this cases the NodeId is always from type numeric and NSId = 0. - */ -int parseServiceNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, char *szFieldName) -{ - gint iOffset = *pOffset; - guint8 EncodingMask, NSId = 0; - guint32 Numeric = 0; - - szFieldName = 0; /* avoid warning */ - - EncodingMask = tvb_get_guint8(tvb, iOffset); - proto_tree_add_item(tree, hf_opcua_nodeid_encodingmask, tvb, iOffset, 1, TRUE); - iOffset++; - - switch(EncodingMask) - { - case 0x00: /* two byte node id */ - Numeric = tvb_get_guint8(tvb, iOffset); - proto_tree_add_item(tree, hf_opcua_app_numeric, tvb, iOffset, 1, TRUE); - iOffset+=1; - break; - case 0x01: /* four byte node id */ - NSId = tvb_get_guint8(tvb, iOffset); - proto_tree_add_item(tree, hf_opcua_app_nsid, tvb, iOffset, 1, TRUE); - iOffset+=1; - Numeric = tvb_get_letohs(tvb, iOffset); - proto_tree_add_item(tree, hf_opcua_app_numeric, tvb, iOffset, 2, TRUE); - iOffset+=2; - break; - case 0x02: /* numeric, that does not fit into four bytes */ - NSId = tvb_get_letohl(tvb, iOffset); - proto_tree_add_item(tree, hf_opcua_app_nsid, tvb, iOffset, 4, TRUE); - iOffset+=4; - Numeric = tvb_get_letohl(tvb, iOffset); - proto_tree_add_item(tree, hf_opcua_app_numeric, tvb, iOffset, 4, TRUE); - iOffset+=4; - break; - case 0x03: /* string */ - case 0x04: /* uri */ - case 0x05: /* guid */ - case 0x06: /* byte string */ - /* NOT USED */ - break; - }; - - *pOffset = iOffset; - - return Numeric; -} - Index: ua_application_layer.h =================================================================== --- ua_application_layer.h (revision 21777) +++ ua_application_layer.h (working copy) @@ -1,27 +0,0 @@ -/****************************************************************************** -** $Id: ua_application_layer.h,v 1.3 2007/02/08 12:19:58 gergap Exp $ -** -** Copyright (C) 2006-2007 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: OpcUa Application Layer Decoder. -** -** Author: Gerhard Gappmeier <gerhard.gappmeier@xxxxxxxxxxx> -** Last change by: $Author: gergap $ -** -******************************************************************************/ - -void registerApplicationLayerTypes(int proto); - -/* Ua type parsers */ -int parseServiceNodeId(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, char *szFieldName); Index: ua_security_layer.c =================================================================== --- ua_security_layer.c (revision 21777) +++ ua_security_layer.c (working copy) @@ -1,99 +0,0 @@ -/****************************************************************************** -** $Id: ua_security_layer.c,v 1.2 2007/02/08 12:16:59 gergap Exp $ -** -** Copyright (C) 2006-2007 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: OpcUa Security Layer Decoder. -** -** Author: Gerhard Gappmeier <gerhard.gappmeier@xxxxxxxxxxx> -** Last change by: $Author: gergap $ -** -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gmodule.h> -#include <epan/packet.h> -#include "ua_application_layer.h" -#include "opcua_simpletypes.h" - -/** NodeClass enum table */ -static const value_string g_SecSigTable[] = { - { 0, "GetSecurityPolcies" }, - { 1, "OpenSecureChannel" }, - { 2, "CloseSecureChannel" }, - { 3, "Message" }, - { 0, NULL } -}; -static int hf_opcua_SecuritySigEnum = -1; - -static int hf_opcua_security_sig = -1; -static int hf_opcua_security_policy = -1; -static int hf_opcua_security_channel = -1; -static int hf_opcua_security_token = -1; - -static hf_register_info hf[] = -{ - { &hf_opcua_security_sig, - { "Security Signature", "security.sig", FT_UINT16, BASE_HEX, VALS(g_SecSigTable), 0x0, "", HFILL } - }, - { &hf_opcua_security_policy, - { "Security Policy", "security.policy", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_security_channel, - { "Secure Channel Id", "security.channel", FT_GUID, BASE_NONE, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_security_token, - { "Security Token Id", "security.token", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL } - } -}; - -/** Register security layer types. */ -void registerSecurityLayerTypes(int proto) -{ - proto_register_field_array(proto, hf, array_length(hf)); -} - - -/* Security Layer: message parsers - * Only works for Security Policy "NoSecurity" at the moment. - */ -void parseSecurityLayer(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) -{ - guint16 Sig; - - Sig = tvb_get_letohs(tvb, pOffset[0]); - proto_tree_add_item(tree, hf_opcua_security_sig, tvb, *pOffset, 2, TRUE); *pOffset+=2; - - switch (Sig) - { - case 0: /* GetSecurityPolicies */ - break; - case 1: /* OpenSecureChannel */ - parseGuid(tree, tvb, pOffset, hf_opcua_security_channel); - parseString(tree, tvb, pOffset, hf_opcua_security_policy); - break; - case 2: /* CloseSecureChannel */ - parseGuid(tree, tvb, pOffset, hf_opcua_security_channel); - parseString(tree, tvb, pOffset, hf_opcua_security_token); - break; - case 3: /* Other Services Messages */ - parseGuid(tree, tvb, pOffset, hf_opcua_security_channel); - parseString(tree, tvb, pOffset, hf_opcua_security_token); - break; - } -} - Index: ua_security_layer.h =================================================================== --- ua_security_layer.h (revision 21777) +++ ua_security_layer.h (working copy) @@ -1,25 +0,0 @@ -/****************************************************************************** -** $Id: ua_security_layer.h,v 1.2 2007/02/08 12:19:58 gergap Exp $ -** -** Copyright (C) 2006-2007 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: OpcUa Security Layer Decoder. -** -** Author: Gerhard Gappmeier <gerhard.gappmeier@xxxxxxxxxxx> -** Last change by: $Author: gergap $ -** -******************************************************************************/ - -void registerSecurityLayerTypes(int proto); -void parseSecurityLayer(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); Index: ua_transport_layer.c =================================================================== --- ua_transport_layer.c (revision 21777) +++ ua_transport_layer.c (working copy) @@ -1,211 +0,0 @@ -/****************************************************************************** -** $Id: ua_transport_layer.c,v 1.3 2007/02/08 12:17:50 gergap Exp $ -** -** Copyright (C) 2006-2007 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: OpcUa Transport Layer Decoder. -** -** Author: Gerhard Gappmeier <gerhard.gappmeier@xxxxxxxxxxx> -** Last change by: $Author: gergap $ -** -******************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <gmodule.h> -#include <epan/packet.h> -#include "ua_security_layer.h" -#include "ua_application_layer.h" -#include "opcua_simpletypes.h" -#include <string.h> -#include <epan/emem.h> - -void dispatchService(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int ServiceId); - -static int hf_opcua_transport_sig = -1; -static int hf_opcua_transport_len = -1; -static int hf_opcua_transport_ver = -1; -static int hf_opcua_transport_cid = -1; -static int hf_opcua_transport_lifetime = -1; -static int hf_opcua_transport_sbl = -1; -static int hf_opcua_transport_rbl = -1; -static int hf_opcua_transport_endpoint = -1; -static int hf_opcua_transport_rlifetime = -1; -static int hf_opcua_transport_rsbl = -1; -static int hf_opcua_transport_rrbl = -1; -static int hf_opcua_transport_altendpoint = -1; -static int hf_opcua_transport_rqid = -1; -static int hf_opcua_transport_status = -1; -extern gint ett_opcua_nodeid; - -static hf_register_info hf[] = -{ - { &hf_opcua_transport_sig, - /* full name , abbreviation , type , display , strings, bitmask, blurb, id, parent, ref_count, bitshift */ - { "Signature", "transport.sig", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_len, - { "Message Length", "transport.len", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_ver, - { "Version", "transport.ver", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_cid, - { "ConnectionId", "transport.cid", FT_GUID, BASE_NONE, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_lifetime, - { "Lifetime", "transport.lifetime", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_sbl, - { "SendBufferLength", "transport.sbl", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_rbl, - { "ReceiveBufferLength", "transport.rbl", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_endpoint, - { "EndPoint", "transport.endpoint", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_rlifetime, - { "Revised Lifetime", "transport.rlifetime", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_rsbl, - { "Revised SendBufferLength", "transport.rsbl", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_rrbl, - { "Revised ReceiveBufferLength", "transport.rrbl", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_altendpoint, - { "Alternate EndPoint", "transport.altendpoint", FT_STRING, BASE_NONE, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_rqid, - { "RequestId", "transport.rqid", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } - }, - { &hf_opcua_transport_status, - { "StatusCode", "transport.status", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL } - } -}; - -/** subtree types */ -extern gint ett_opcua_extensionobject; - -/** Register transport layer types. */ -void registerTransportLayerTypes(int proto) -{ - proto_register_field_array(proto, hf, array_length(hf)); -} - -/** helper functions for adding strings, - * that are not zero terminated. - */ -void addString(proto_tree *tree, - int hfindex, - tvbuff_t *tvb, - gint start, - gint length, - const char *value) -{ - char *szValue = ep_alloc(256); - - if (szValue) - { - if (length > 255) length = 255; - /* copy non null terminated string data */ - strncpy(szValue, value, length); - /* set null terminator */ - szValue[length] = 0; - - proto_tree_add_string(tree, hfindex, tvb, start, length, szValue); - } -} - -/* Transport Layer: message parsers */ -void parseHello(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) -{ - addString(tree, hf_opcua_transport_sig, tvb, *pOffset, 4, tvb->real_data); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_len, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_ver, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_cid, tvb, *pOffset, 16, TRUE); *pOffset+=16; - proto_tree_add_item(tree, hf_opcua_transport_lifetime, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_sbl, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_rbl, tvb, *pOffset, 4, TRUE); *pOffset+=4; - parseString(tree, tvb, pOffset, hf_opcua_transport_endpoint); -} - -void parseAcknowledge(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) -{ - addString(tree, hf_opcua_transport_sig, tvb, *pOffset, 4, tvb->real_data); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_len, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_cid, tvb, *pOffset, 16, TRUE); *pOffset+=16; - proto_tree_add_item(tree, hf_opcua_transport_rlifetime, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_rsbl, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_rrbl, tvb, *pOffset, 4, TRUE); *pOffset+=4; - parseString(tree, tvb, pOffset, hf_opcua_transport_altendpoint); -} - -void parseDisconnect(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) -{ - addString(tree, hf_opcua_transport_sig, tvb, *pOffset, 4, tvb->real_data); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_len, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_cid, tvb, *pOffset, 16, TRUE); *pOffset+=16; -} - -void parseData(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) -{ - proto_item *ti; - proto_tree *encobj_tree; - proto_tree *nodeid_tree; - int ServiceId = 0; - - addString(tree, hf_opcua_transport_sig, tvb, *pOffset, 4, tvb->real_data); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_len, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_cid, tvb, *pOffset, 16, TRUE); *pOffset+=16; - proto_tree_add_item(tree, hf_opcua_transport_rqid, tvb, *pOffset, 4, TRUE); *pOffset+=4; - - /* message data contains the security layer */ - parseSecurityLayer(tree, tvb, pOffset); - - /* AT THE MOMENT NO SECURITY IS IMPLEMENTED IN UA. - * WE CAN JUST JUMP INTO THE APPLICATION LAYER DATA. - * THIS WILL CHAHNGE IN THE FUTURE. */ - - /* add encodeable object subtree */ - ti = proto_tree_add_text(tree, tvb, 0, -1, "Message : Encodeable Object"); - encobj_tree = proto_item_add_subtree(ti, ett_opcua_extensionobject); - - /* add nodeid subtree */ - ti = proto_tree_add_text(encobj_tree, tvb, 0, -1, "TypeId : ExpandedNodeId"); - nodeid_tree = proto_item_add_subtree(ti, ett_opcua_nodeid); - ServiceId = parseServiceNodeId(nodeid_tree, tvb, pOffset, "NodeId") - 1; - - dispatchService(encobj_tree, tvb, pOffset, ServiceId); -} - -void parseAbort(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) -{ - addString(tree, hf_opcua_transport_sig, tvb, *pOffset, 4, tvb->real_data); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_len, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_cid, tvb, *pOffset, 16, TRUE); *pOffset+=16; - proto_tree_add_item(tree, hf_opcua_transport_rqid, tvb, *pOffset, 4, TRUE); *pOffset+=4; -} - -void parseError(proto_tree *tree, tvbuff_t *tvb, gint *pOffset) -{ - addString(tree, hf_opcua_transport_sig, tvb, *pOffset, 4, tvb->real_data); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_len, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_cid, tvb, *pOffset, 16, TRUE); *pOffset+=16; - proto_tree_add_item(tree, hf_opcua_transport_rqid, tvb, *pOffset, 4, TRUE); *pOffset+=4; - proto_tree_add_item(tree, hf_opcua_transport_status, tvb, *pOffset, 4, TRUE); *pOffset+=4; -} Index: ua_transport_layer.h =================================================================== --- ua_transport_layer.h (revision 21777) +++ ua_transport_layer.h (working copy) @@ -1,32 +0,0 @@ -/****************************************************************************** -** $Id: ua_transport_layer.h,v 1.3 2007/02/08 12:19:58 gergap Exp $ -** -** Copyright (C) 2006-2007 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: OpcUa Transport Layer Decoder. -** -** Author: Gerhard Gappmeier <gerhard.gappmeier@xxxxxxxxxxx> -** Last change by: $Author: gergap $ -** -******************************************************************************/ - -/* Transport Layer: message parsers */ -void parseHello(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); -void parseAcknowledge(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); -void parseDisconnect(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); -void parseData(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); -void parseAbort(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); -void parseError(proto_tree *tree, tvbuff_t *tvb, gint *pOffset); -void registerTransportLayerTypes(int proto); -
- Follow-Ups:
- Re: [Wireshark-dev] OpcUa update
- From: Ulf Lamping
- Re: [Wireshark-dev] OpcUa update
- References:
- Re: [Wireshark-dev] OpcUa update
- From: Ulf Lamping
- Re: [Wireshark-dev] OpcUa update
- From: Gerhard Gappmeier
- Re: [Wireshark-dev] OpcUa update
- From: Ulf Lamping
- Re: [Wireshark-dev] OpcUa update
- From: Gerhard Gappmeier
- Re: [Wireshark-dev] OpcUa update
- From: Ulf Lamping
- Re: [Wireshark-dev] OpcUa update
- From: Gerhard Gappmeier
- Re: [Wireshark-dev] OpcUa update
- From: Ulf Lamping
- Re: [Wireshark-dev] OpcUa update
- From: Gerhard Gappmeier
- Re: [Wireshark-dev] OpcUa update
- Prev by Date: Re: [Wireshark-dev] Live piping of pcap formatted files to Wireshark
- Next by Date: Re: [Wireshark-dev] OpCua faulty checkin and breaks the build
- Previous by thread: Re: [Wireshark-dev] OpcUa update
- Next by thread: Re: [Wireshark-dev] OpcUa update
- Index(es):