1 /******************************************************************************
2 ** Copyright (C) 2006-2009 ascolab GmbH. All Rights Reserved.
3 ** Web: http://www.ascolab.com
5 ** SPDX-License-Identifier: GPL-2.0-or-later
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.
10 ** Project: OpcUa Wireshark Plugin
12 ** Description: OpcUa Transport Layer Decoder.
14 ** Author: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com>
15 ******************************************************************************/
17 /* This struct is used to pass meta data down to decoding functions. */
19 bool encrypted
; /* true if payload is encrypted, false if no encryption was used or it was successfully decrypted. */
22 extern int g_opcua_default_sig_len
;
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
);
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.
41 #include "opcua_simpletypes.h"
42 static inline uintptr_t
43 construct_encryption_info(enum ua_message_mode mode
, uint8_t sig_len
)
45 return ((uintptr_t)sig_len
<< 8) | (uintptr_t)mode
;
48 static inline enum ua_message_mode
49 extract_message_mode(uintptr_t data
)
51 return (enum ua_message_mode
)(data
& 0xff);
55 extract_signature_length(uintptr_t data
)
57 return (uint8_t)(data
>> 8);
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
);