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"
32 /** NodeClass enum table */
33 static const value_string g_SecSigTable
[] = {
34 { 0, "GetSecurityPolcies" },
35 { 1, "OpenSecureChannel" },
36 { 2, "CloseSecureChannel" },
42 static int hf_opcua_security_tokenid
= -1;
43 static int hf_opcua_security_seq
= -1;
44 static int hf_opcua_security_rqid
= -1;
46 /** Register security layer types. */
47 void registerSecurityLayerTypes(int proto
)
49 static hf_register_info hf
[] =
51 { &hf_opcua_security_tokenid
,
52 { "Security Token Id", "security.tokenid", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
54 { &hf_opcua_security_seq
,
55 { "Security Sequence Number", "security.seq", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
57 { &hf_opcua_security_rqid
,
58 { "Security RequestId", "security.rqid", FT_UINT32
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
61 proto_register_field_array(proto
, hf
, array_length(hf
));
64 /* Security Layer: message parsers
65 * Only works for Security Policy "NoSecurity" at the moment.
67 void parseSecurityLayer(proto_tree
*tree
, tvbuff_t
*tvb
, gint
*pOffset
)
69 proto_tree_add_item(tree
, hf_opcua_security_tokenid
, tvb
, *pOffset
, 4, ENC_LITTLE_ENDIAN
); *pOffset
+=4;
70 proto_tree_add_item(tree
, hf_opcua_security_seq
, tvb
, *pOffset
, 4, ENC_LITTLE_ENDIAN
); *pOffset
+=4;
71 proto_tree_add_item(tree
, hf_opcua_security_rqid
, tvb
, *pOffset
, 4, ENC_LITTLE_ENDIAN
); *pOffset
+=4;