| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
opcua_transport_layer.h
1/******************************************************************************
2** Copyright (C) 2006-2009 ascolab GmbH. All Rights Reserved.
3** Web: http://www.ascolab.com
4**
5** SPDX-License-Identifier: GPL-2.0-or-later
6**
7** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
8** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
9**
10** Project: OpcUa Wireshark Plugin
11**
12** Description: OpcUa Transport Layer Decoder.
13**
14** Author: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com>
15******************************************************************************/
16
17/* This struct is used to pass meta data down to decoding functions. */
18 struct ua_metadata {
19 bool encrypted; /* true if payload is encrypted, false if no encryption was used or it was successfully decrypted. */
20};
21
22 extern int g_opcua_default_sig_len;
23
24/* Transport Layer: message parsers */
25 int parseHello(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset, struct ua_metadata *data);
26 int parseAcknowledge(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset, struct ua_metadata *data);
27 int parseError(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset, struct ua_metadata *data);
28 int parseReverseHello(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset, struct ua_metadata *data);
29 int parseMessage(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset, struct ua_metadata *data);
30 int parseAbort(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset, struct ua_metadata *data);
31 int parseService(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset, struct ua_metadata *data);
32 int parseOpenSecureChannel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset, struct ua_metadata *data);
33 int parseCloseSecureChannel(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int *pOffset, struct ua_metadata *data);
34 void registerTransportLayerTypes(int proto);
35
36/*
37 * The per-conversation encryption information is stored in a pointer
38 * value; here are functions to construct the pointer value, as a
39 * uintptr_t and extract values from the pointer value.
40 */
41#include "opcua_simpletypes.h"
42 static inline uintptr_t
43construct_encryption_info(enum ua_message_mode mode, uint8_t sig_len)
44{
45 return ((uintptr_t)sig_len << 8) | (uintptr_t)mode;
46}
47
48 static inline enum ua_message_mode
49extract_message_mode(uintptr_t data)
50{
51 return (enum ua_message_mode)(data & 0xff);
52}
53
54 static inline uint8_t
55extract_signature_length(uintptr_t data)
56{
57 return (uint8_t)(data >> 8);
58}
59
60 void store_encryption_info(packet_info *pinfo, enum ua_message_mode mode, uint8_t sig_len);
61 void get_encryption_info(packet_info *pinfo, enum ua_message_mode *mode, uint8_t *sig_len);
_packet_info
Definition packet_info.h:43
_proto_node
Definition proto.h:905
tvbuff
Definition tvbuff-int.h:36
ua_metadata
Definition opcua_transport_layer.h:18