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: OpcUa Security Layer Decoder.
19 ** Author: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com>
20 ** Last change by: $Author: gergap $
22 ******************************************************************************/
27 #include <epan/packet.h>
28 #include "opcua_application_layer.h"
29 #include "opcua_simpletypes.h"
31 /** NodeClass enum table */
32 static const value_string g_SecSigTable[] = {
33 { 0, "GetSecurityPolcies" },
34 { 1, "OpenSecureChannel" },
35 { 2, "CloseSecureChannel" },
40 static int hf_opcua_security_tokenid = -1;
41 static int hf_opcua_security_seq = -1;
42 static int hf_opcua_security_rqid = -1;
44 /** Register security layer types. */
45 void registerSecurityLayerTypes(int proto)
47 static hf_register_info hf[] =
49 { &hf_opcua_security_tokenid,
50 { "Security Token Id", "security.tokenid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
52 { &hf_opcua_security_seq,
53 { "Security Sequence Number", "security.seq", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
55 { &hf_opcua_security_rqid,
56 { "Security RequestId", "security.rqid", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
59 proto_register_field_array(proto, hf, array_length(hf));
62 /* Security Layer: message parsers
63 * Only works for Security Policy "NoSecurity" at the moment.
65 void parseSecurityLayer(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)
67 proto_tree_add_item(tree, hf_opcua_security_tokenid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4;
68 proto_tree_add_item(tree, hf_opcua_security_seq, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4;
69 proto_tree_add_item(tree, hf_opcua_security_rqid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4;