Wireshark  4.3.0
The Wireshark network protocol analyzer
opcua_simpletypes.h
1 /******************************************************************************
2 ** Copyright (C) 2006-2007 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: Implementation of OpcUa built-in type parsers.
13 ** This contains all the simple types and some complex types.
14 **
15 ** Author: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com>
16 ******************************************************************************/
17 #include "opcua_identifiers.h"
18 
19 /* simple header fields */
20 extern int hf_opcua_returnDiag;
21 extern int hf_opcua_returnDiag_mask_sl_symbolicId;
22 extern int hf_opcua_returnDiag_mask_sl_localizedText;
23 extern int hf_opcua_returnDiag_mask_sl_additionalinfo;
24 extern int hf_opcua_returnDiag_mask_sl_innerstatuscode;
25 extern int hf_opcua_returnDiag_mask_sl_innerdiagnostics;
26 extern int hf_opcua_returnDiag_mask_ol_symbolicId;
27 extern int hf_opcua_returnDiag_mask_ol_localizedText;
28 extern int hf_opcua_returnDiag_mask_ol_additionalinfo;
29 extern int hf_opcua_returnDiag_mask_ol_innerstatuscode;
30 extern int hf_opcua_returnDiag_mask_ol_innerdiagnostics;
31 extern int hf_opcua_nodeClassMask;
32 extern int hf_opcua_nodeClassMask_object;
33 extern int hf_opcua_nodeClassMask_variable;
34 extern int hf_opcua_nodeClassMask_method;
35 extern int hf_opcua_nodeClassMask_objecttype;
36 extern int hf_opcua_nodeClassMask_variabletype;
37 extern int hf_opcua_nodeClassMask_referencetype;
38 extern int hf_opcua_nodeClassMask_datatype;
39 extern int hf_opcua_nodeClassMask_view;
40 
41 /* simple types trees */
42 extern gint ett_opcua_array_Boolean;
43 extern gint ett_opcua_array_SByte;
44 extern gint ett_opcua_array_Byte;
45 extern gint ett_opcua_array_Int16;
46 extern gint ett_opcua_array_UInt16;
47 extern gint ett_opcua_array_Int32;
48 extern gint ett_opcua_array_UInt32;
49 extern gint ett_opcua_array_Int64;
50 extern gint ett_opcua_array_UInt64;
51 extern gint ett_opcua_array_Float;
52 extern gint ett_opcua_array_Double;
53 extern gint ett_opcua_array_String;
54 extern gint ett_opcua_array_DateTime;
55 extern gint ett_opcua_array_Guid;
56 extern gint ett_opcua_array_ByteString;
57 extern gint ett_opcua_array_XmlElement;
58 extern gint ett_opcua_array_NodeId;
59 extern gint ett_opcua_array_ExpandedNodeId;
60 extern gint ett_opcua_array_StatusCode;
61 extern gint ett_opcua_array_DiagnosticInfo;
62 extern gint ett_opcua_array_QualifiedName;
63 extern gint ett_opcua_array_LocalizedText;
64 extern gint ett_opcua_array_ExtensionObject;
65 extern gint ett_opcua_array_DataValue;
66 extern gint ett_opcua_array_Variant;
67 extern gint ett_opcua_returnDiagnostics;
68 
69 enum ua_message_mode {
70  UA_MessageMode_Unknown = 0,
71  UA_MessageMode_None,
72  UA_MessageMode_Sign,
73  UA_MessageMode_SignAndEncrypt,
74  UA_MessageMode_MaybeEncrypted
75 };
76 
77 /* simple types */
78 proto_item* parseBoolean(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
79 proto_item* parseByte(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
80 proto_item* parseSByte(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
81 proto_item* parseUInt16(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
82 proto_item* parseInt16(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
83 proto_item* parseUInt32(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
84 proto_item* parseInt32(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
85 proto_item* parseUInt64(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
86 proto_item* parseInt64(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
87 proto_item* parseString(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
88 proto_item* parseString_ret_string_and_length(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint *pOffset, int hfIndex, const guint8 **retval, gint *lenretval);
89 proto_item* parseGuid(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
90 proto_item* parseByteString(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
91 proto_item* parseXmlElement(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
92 proto_item* parseFloat(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
93 proto_item* parseDouble(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
94 proto_item* parseDateTime(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
95 proto_item* parseStatusCode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
96 /* complex types */
97 void parseLocalizedText(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName);
98 void parseNodeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName);
99 void parseDiagnosticInfo(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName);
100 void parseExtensionObject(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName);
101 void parseQualifiedName(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName);
102 void parseCertificate(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int hfIndex);
103 void parseDataValue(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName);
104 void parseVariant(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName);
105 void parseExpandedNodeId(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName);
106 void parseArraySimple(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName, const char *szTypeName, int hfIndex, fctSimpleTypeParser pParserFunction, const gint idx);
107 void parseArrayEnum(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName, const char *szTypeName, fctEnumParser pParserFunction, const gint idx);
108 void parseArrayComplex(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, const char *szFieldName, const char *szTypeName, fctComplexTypeParser pParserFunction, const gint idx);
109 void registerSimpleTypes(int proto);
110 guint32 getExtensionObjectType(tvbuff_t *tvb, gint *pOffset);
111 void parseNodeClassMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset);
112 void parseResultMask(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset);
113 
114 void dispatchExtensionObjectType(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint *pOffset, int TypeId);
115 
Definition: packet_info.h:44
Definition: proto.h:904
Definition: tvbuff-int.h:35