open62541pp 0.16.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
common.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string_view>
5
7
8namespace opcua {
9
10/// Namespace index.
11/// @see https://reference.opcfoundation.org/Core/Part3/v105/docs/8.2.2
12using NamespaceIndex = uint16_t;
13
14/// Namespace with index and URI.
15struct Namespace {
17 std::string_view uri;
18};
19
20/// Type index of the ::UA_TYPES array.
21using TypeIndex = uint16_t;
22
23/**
24 * Attribute identifiers.
25 * @see UA_AttributeId
26 * @see https://reference.opcfoundation.org/Core/Part3/v105/docs/5.9
27 */
28enum class AttributeId : int32_t {
29 // clang-format off
30 NodeId = 1, /**< @include{doc} attributes/nodeid.dox */
31 NodeClass = 2, /**< @include{doc} attributes/nodeclass.dox */
32 BrowseName = 3, /**< @include{doc} attributes/browsename.dox */
33 DisplayName = 4, /**< @include{doc} attributes/displayname.dox */
34 Description = 5, /**< @include{doc} attributes/description.dox */
35 WriteMask = 6, /**< @include{doc} attributes/writemask.dox */
36 UserWriteMask = 7, /**< @include{doc} attributes/userwritemask.dox */
37 IsAbstract = 8, /**< @include{doc} attributes/isabstract.dox */
38 Symmetric = 9, /**< @include{doc} attributes/symmetric.dox */
39 InverseName = 10, /**< @include{doc} attributes/inversename.dox */
40 ContainsNoLoops = 11, /**< @include{doc} attributes/containsnoloops.dox */
41 EventNotifier = 12, /**< @include{doc} attributes/eventnotifier.dox */
42 Value = 13, /**< @include{doc} attributes/value.dox */
43 DataType = 14, /**< @include{doc} attributes/datatype.dox */
44 ValueRank = 15, /**< @include{doc} attributes/valuerank.dox */
45 ArrayDimensions = 16, /**< @include{doc} attributes/arraydimensions.dox */
46 AccessLevel = 17, /**< @include{doc} attributes/accesslevel.dox */
47 UserAccessLevel = 18, /**< @include{doc} attributes/useraccesslevel.dox */
48 MinimumSamplingInterval = 19, /**< @include{doc} attributes/minimumsamplinginterval.dox */
49 Historizing = 20, /**< @include{doc} attributes/historizing.dox */
50 Executable = 21, /**< @include{doc} attributes/executable.dox */
51 UserExecutable = 22, /**< @include{doc} attributes/userexecutable.dox */
52 DataTypeDefinition = 23, /**< @include{doc} attributes/datatypedefinition.dox */
53 RolePermissions = 24, /**< @include{doc} attributes/rolepermissions.dox */
54 UserRolePermissions = 25, /**< @include{doc} attributes/userrolepermissions.dox */
55 AccessRestrictions = 26, /**< @include{doc} attributes/accessrestrictions.dox */
56 AccessLevelEx = 27, /**< @include{doc} attributes/accesslevelex.dox */
57 // clang-format on
58};
59
60/**
61 * Node class.
62 *
63 * The enum can be used as a bitmask and allows bitwise operations, e.g.:
64 * @code
65 * auto mask = NodeClass::Object | NodeClass::Variable;
66 * @endcode
67 *
68 * @see UA_NodeClass
69 * @see https://reference.opcfoundation.org/Core/Part3/v105/docs/8.29
70 */
71enum class NodeClass : int32_t {
72 // clang-format off
73 Unspecified = 0,
74 Object = 1,
75 Variable = 2,
76 Method = 4,
77 ObjectType = 8,
78 VariableType = 16,
79 ReferenceType = 32,
80 DataType = 64,
81 View = 128,
82 // clang-format on
83};
84
85template <>
86struct IsBitmaskEnum<NodeClass> : std::true_type {};
87
88/**
89 * Access level.
90 * Indicates how the value of an variable can be accessed (read/write) and if it contains current
91 * and/or historic data.
92 * @see https://reference.opcfoundation.org/Core/Part3/v104/docs/8.57
93 */
94enum class AccessLevel : uint8_t {
95 // clang-format off
96 None = 0U,
97 CurrentRead = 1U << 0U,
98 CurrentWrite = 1U << 1U,
99 HistoryRead = 1U << 2U,
100 HistoryWrite = 1U << 3U,
101 SemanticChange = 1U << 4U,
102 StatusWrite = 1U << 5U,
103 TimestampWrite = 1U << 6U,
104 // clang-format on
105};
106
107template <>
108struct IsBitmaskEnum<AccessLevel> : std::true_type {};
109
110/**
111 * Write mask.
112 * Indicates which attributes of a node a writeable.
113 * @see https://reference.opcfoundation.org/Core/Part3/v105/docs/5.2.7
114 * @see https://reference.opcfoundation.org/Core/Part3/v105/docs/8.60
115 */
116enum class WriteMask : uint32_t {
117 // clang-format off
118 None = 0U,
119 AccessLevel = 1U << 0U,
120 ArrayDimensions = 1U << 1U,
121 BrowseName = 1U << 2U,
122 ContainsNoLoops = 1U << 3U,
123 DataType = 1U << 4U,
124 Description = 1U << 5U,
125 DisplayName = 1U << 6U,
126 EventNotifier = 1U << 7U,
127 Executable = 1U << 8U,
128 Historizing = 1U << 9U,
129 InverseName = 1U << 10U,
130 IsAbstract = 1U << 11U,
131 MinimumSamplingInterval = 1U << 12U,
132 NodeClass = 1U << 13U,
133 NodeId = 1U << 14U,
134 Symmetric = 1U << 15U,
135 UserAccessLevel = 1U << 16U,
136 UserExecutable = 1U << 17U,
137 UserWriteMask = 1U << 18U,
138 ValueRank = 1U << 19U,
139 WriteMask = 1U << 20U,
140 ValueForVariableType = 1U << 21U,
141 DataTypeDefinition = 1U << 22U,
142 RolePermissions = 1U << 23U,
143 AccessRestrictions = 1U << 24U,
144 AccessLevelEx = 1U << 25U,
145 // clang-format on
146};
147
148template <>
149struct IsBitmaskEnum<WriteMask> : std::true_type {};
150
151/**
152 * Value rank.
153 * Indicates whether the value attribute of the variable is an array and how many dimensions the
154 * array has.
155 * @see https://reference.opcfoundation.org/Core/Part3/v105/docs/5.6.2
156 */
157enum class ValueRank : int32_t {
158 // clang-format off
159 ScalarOrOneDimension = -3, // UA_VALUERANK_SCALAR_OR_ONE_DIMENSION
160 Any = -2, // UA_VALUERANK_ANY
161 Scalar = -1, // UA_VALUERANK_SCALAR
162 OneOrMoreDimensions = 0, // UA_VALUERANK_ONE_OR_MORE_DIMENSIONS
163 OneDimension = 1, // UA_VALUERANK_ONE_DIMENSION
164 TwoDimensions = 2, // UA_VALUERANK_TWO_DIMENSIONS
165 ThreeDimensions = 3, // UA_VALUERANK_THREE_DIMENSIONS
166 // clang-format on
167};
168
169/**
170 * Event notifier.
171 * Indicates if a node can be used to subscribe to events or read/write historic events.
172 * @see https://reference.opcfoundation.org/Core/Part3/v105/docs/8.59
173 */
174enum class EventNotifier : uint8_t {
175 // clang-format off
176 None = 0,
178 HistoryRead = 4,
179 HistoryWrite = 8,
180 // clang-format on
181};
182
183template <>
184struct IsBitmaskEnum<EventNotifier> : std::true_type {};
185
186/**
187 * Modelling rules.
188 * @see https://reference.opcfoundation.org/Core/Part3/v105/docs/6.4.4
189 */
190enum class ModellingRule : uint16_t {
191 // clang-format off
192 Mandatory = 78, // UA_NS0ID_MODELLINGRULE_MANDATORY
193 Optional = 80, // UA_NS0ID_MODELLINGRULE_OPTIONAL
194 ExposesItsArray = 83, // UA_NS0ID_MODELLINGRULE_EXPOSESITSARRAY
195 OptionalPlaceholder = 11508, // UA_NS0ID_MODELLINGRULE_OPTIONALPLACEHOLDER
196 MandatoryPlaceholder = 11510, // UA_NS0ID_MODELLINGRULE_MANDATORYPLACEHOLDER
197 // clang-format on
198};
199
200/**
201 * Browse direction.
202 * An enumeration that specifies the direction of references to follow.
203 * @see UA_BrowseDirection
204 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/7.5
205 */
206enum class BrowseDirection : int32_t {
207 // clang-format off
208 Forward = 0,
209 Inverse = 1,
210 Both = 2,
211 Invalid = 3,
212 // clang-format on
213};
214
215/**
216 * Timestamps to return.
217 * @see UA_TimestampsToReturn
218 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/7.40
219 */
220enum class TimestampsToReturn : int32_t {
221 // clang-format off
222 Source = 0,
223 Server = 1,
224 Both = 2,
225 Neither = 3,
226 Invalid = 4,
227 // clang-format on
228};
229
230/**
231 * Monitoring mode.
232 * @see UA_MonitoringMode
233 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/7.23
234 */
235enum class MonitoringMode : int32_t {
236 // clang-format off
237 Disabled = 0,
238 Sampling = 1,
239 Reporting = 2,
240 // clang-format on
242
243/**
244 * Message security mode.
245 * @see UA_MessageSecurityMode
246 * @see https://reference.opcfoundation.org/Core/Part4/v105/docs/7.20
247 */
248enum class MessageSecurityMode : int32_t {
249 // clang-format off
250 Invalid = 0, ///< Will always be rejected
251 None = 1, ///< No security applied
252 Sign = 2, ///< All messages are signed but not encrypted
253 SignAndEncrypt = 3, ///< All messages are signed and encrypted
254 // clang-format on
255};
256
257} // namespace opcua
UA_DataType wrapper class.
Definition datatype.hpp:27
UA_NodeId wrapper class.
Definition types.hpp:590
High-level server class.
Definition server.hpp:132
uint16_t TypeIndex
Type index of the UA_TYPES array.
Definition common.hpp:21
NodeClass
Node class.
Definition common.hpp:138
AccessLevel
Access level.
Definition common.hpp:161
EventNotifier
Event notifier.
Definition common.hpp:241
ValueRank
Value rank.
Definition common.hpp:224
BrowseDirection
Browse direction.
Definition common.hpp:273
TimestampsToReturn
Timestamps to return.
Definition common.hpp:287
MonitoringMode
Monitoring mode.
Definition common.hpp:302
WriteMask
Write mask.
Definition common.hpp:183
uint16_t NamespaceIndex
Namespace index.
Definition common.hpp:12
AttributeId
Attribute identifiers.
Definition common.hpp:28
@ UserExecutable
Indicates if the method is currently executable taking user access rights into account.
@ Historizing
Indicates whether the server is actively collecting data for the history of the variable.
@ AccessRestrictions
Specifies access restrictions that apply to a node.
@ Executable
Indicates if the method is currently executable.
@ DisplayName
The localized name of the node.
@ NodeId
Unambiguous identifier of a node.
@ BrowseName
A non-localised human-readable name used to browse the address space.
@ Value
The most recent value of the variable that the server has.
@ AccessLevelEx
Extended version of the AccessLevel attribute.
@ MinimumSamplingInterval
Specifies (in milliseconds) how fast the server can reasonably sample the value for changes.
@ UserRolePermissions
Specifies the permissions that apply to a node for all roles granted to current session.
@ IsAbstract
If a reference is abstract, no reference of this type shall exist, only of its subtypes.
@ InverseName
The inverse name describes the reference type as seen from the target node.
@ DataType
The NodeId of the data type definition for the Value attribute.
@ Description
Explains the meaning of the node in a localized text.
@ UserWriteMask
Exposes the possibilities of a client to write the attributes of the node.
@ ArrayDimensions
Specifies the maximum supported length of each dimension of the Value attribute.
@ ContainsNoLoops
Indicates that by following the references in the context of the view there are no loops.
@ RolePermissions
Permissions that apply to a node.
@ UserAccessLevel
Indicates how the value of a variable can be accessed (read/write) and if it contains current and/or ...
@ DataTypeDefinition
Provides the meta data and encoding information for custom data types.
@ Symmetric
If a reference is symmetric, it can seen from both the source and target node.
ModellingRule
Modelling rules.
Definition common.hpp:257
MessageSecurityMode
Message security mode.
Definition common.hpp:315
@ Sign
All messages are signed but not encrypted.
@ SignAndEncrypt
All messages are signed and encrypted.
Trait to define an enum (class) as a bitmask and allow bitwise operations.
Definition bitmask.hpp:44
Namespace with index and URI.
Definition common.hpp:15
std::string_view uri
Definition common.hpp:17
NamespaceIndex index
Definition common.hpp:16