s4-rpc_server: Add back support for lsa over \\pipe\\netlogon optionally
[metze/wireshark/wip.git] / plugins / opcua / opcua_security_layer.c
1 /******************************************************************************
2 ** Copyright (C) 2006-2007 ascolab GmbH. All Rights Reserved.
3 ** Web: http://www.ascolab.com
4 **
5 ** This program is free software; you can redistribute it and/or
6 ** modify it under the terms of the GNU General Public License
7 ** as published by the Free Software Foundation; either version 2
8 ** of the License, or (at your option) any later version.
9 **
10 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 **
13 ** Project: OpcUa Wireshark Plugin
14 **
15 ** Description: OpcUa Security Layer Decoder.
16 **
17 ** Author: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com>
18 ******************************************************************************/
19
20 #include "config.h"
21
22 #include <epan/packet.h>
23 #include "opcua_security_layer.h"
24
25 static int hf_opcua_security_tokenid = -1;
26 static int hf_opcua_security_seq = -1;
27 static int hf_opcua_security_rqid = -1;
28
29 /** Register security layer types. */
30 void registerSecurityLayerTypes(int proto)
31 {
32     static hf_register_info hf[] =
33     {
34         /* id                           full name                   abbreviation              type       display   strings bitmask blurb HFILL */
35         {&hf_opcua_security_tokenid,   {"Security Token Id",        "opcua.security.tokenid", FT_UINT32, BASE_DEC, NULL,   0x0,    NULL, HFILL}},
36         {&hf_opcua_security_seq,       {"Security Sequence Number", "opcua.security.seq",     FT_UINT32, BASE_DEC, NULL,   0x0,    NULL, HFILL}},
37         {&hf_opcua_security_rqid,      {"Security RequestId",       "opcua.security.rqid",    FT_UINT32, BASE_DEC, NULL,   0x0,    NULL, HFILL}}
38     };
39     proto_register_field_array(proto, hf, array_length(hf));
40 }
41
42 /* Security Layer: message parsers
43  * Only works for Security Policy "NoSecurity" at the moment.
44  */
45 void parseSecurityLayer(proto_tree *tree, tvbuff_t *tvb, gint *pOffset)
46 {
47     proto_tree_add_item(tree, hf_opcua_security_tokenid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4;
48     proto_tree_add_item(tree, hf_opcua_security_seq, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4;
49     proto_tree_add_item(tree, hf_opcua_security_rqid, tvb, *pOffset, 4, ENC_LITTLE_ENDIAN); *pOffset+=4;
50 }
51
52 /*
53  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
54  *
55  * Local variables:
56  * c-basic-offset: 4
57  * tab-width: 8
58  * indent-tabs-mode: nil
59  * End:
60  *
61  * vi: set shiftwidth=4 tabstop=8 expandtab:
62  * :indentSize=4:tabSize=8:noTabs=true:
63  */