Browse Source

rename ua_statuscodes.h to ua_constants.h

this lets us group standard-defined constants, including the statuscodes.
 source, documentation and build scripts are aligned to the change.
small improvement of the documentation as a by-product
Julius Pfrommer 8 years ago
parent
commit
bf191143be

+ 1 - 1
CMakeLists.txt

@@ -161,7 +161,7 @@ include_directories(${PROJECT_BINARY_DIR}/src_generated) #needed to locate an in
 configure_file("include/ua_config.h.in" "${PROJECT_BINARY_DIR}/src_generated/ua_config.h")
 
 set(exported_headers ${PROJECT_BINARY_DIR}/src_generated/ua_config.h
-                     ${PROJECT_SOURCE_DIR}/include/ua_statuscodes.h
+                     ${PROJECT_SOURCE_DIR}/include/ua_constants.h
                      ${PROJECT_SOURCE_DIR}/include/ua_types.h
                      ${PROJECT_BINARY_DIR}/src_generated/ua_nodeids.h
                      ${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.h

+ 3 - 3
doc/CMakeLists.txt

@@ -12,13 +12,13 @@ function(generate_rst in out)
 endfunction()
 
 generate_rst(${PROJECT_SOURCE_DIR}/include/ua_types.h ${PROJECT_BINARY_DIR}/doc_src/types.rst)
-generate_rst(${PROJECT_SOURCE_DIR}/include/ua_statuscodes.h ${PROJECT_BINARY_DIR}/doc_src/statuscodes.rst)
+generate_rst(${PROJECT_SOURCE_DIR}/include/ua_constants.h ${PROJECT_BINARY_DIR}/doc_src/constants.rst)
 generate_rst(${PROJECT_BINARY_DIR}/src_generated/ua_types_generated.h ${PROJECT_BINARY_DIR}/doc_src/types_generated.rst)
 
 add_custom_target(doc_latex ${SPHINX_EXECUTABLE}
   -b latex -c "${PROJECT_BINARY_DIR}/doc_src" "${PROJECT_BINARY_DIR}/doc_src" "${PROJECT_BINARY_DIR}/doc_latex"
   DEPENDS ${PROJECT_BINARY_DIR}/doc_src/types.rst
-  DEPENDS ${PROJECT_BINARY_DIR}/doc_src/statuscodes.rst
+  DEPENDS ${PROJECT_BINARY_DIR}/doc_src/constants.rst
   DEPENDS ${PROJECT_BINARY_DIR}/doc_src/types_generated.rst
   COMMENT "Building LaTeX sources for documentation with Sphinx")
 add_dependencies(doc_latex open62541)
@@ -27,7 +27,7 @@ add_custom_target(doc ${SPHINX_EXECUTABLE}
   -b html -c "${PROJECT_BINARY_DIR}/doc_src" "${PROJECT_BINARY_DIR}/doc_src" "${PROJECT_BINARY_DIR}/doc"
   COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_BINARY_DIR}/doc_src/open62541_html.png" "${PROJECT_BINARY_DIR}/doc/_static/"
   DEPENDS ${PROJECT_BINARY_DIR}/doc_src/types.rst
-  DEPENDS ${PROJECT_BINARY_DIR}/doc_src/statuscodes.rst
+  DEPENDS ${PROJECT_BINARY_DIR}/doc_src/constants.rst
   DEPENDS ${PROJECT_BINARY_DIR}/doc_src/types_generated.rst
   COMMENT "Building HTML documentation with Sphinx")
 add_dependencies(doc open62541)

+ 1 - 1
doc/index.rst

@@ -24,6 +24,6 @@ standard.
    building
    tutorials
    types
-   statuscodes
+   constants
    types_generated
 

+ 2 - 2
doc/tutorial_client_firstSteps.rst

@@ -27,7 +27,7 @@ As a recap, your directory structure should now look like this::
   │   ├── ua_nodeids.h
   │   ├── ua_server_external_ns.h
   │   ├── ua_server.h
-  │   ├── ua_statuscodes.h
+  │   ├── ua_constants.h
   │   ├── ua_transport_generated_encoding_binary.h
   │   ├── ua_transport_generated.h
   │   ├── ua_types_generated_encoding_binary.h
@@ -71,7 +71,7 @@ Let's recompile both server and client - if you feel up to it, you can create a
 Asserting success/failure
 -------------------------
 
-Almost all functions of the open62541 API will return a ``UA_StatusCode``, which in the C world would be represented by a ``unsigned int``. OPC UA defines large number of good and bad return codes represented by this number. The constant UA_STATUSCODE_GOOD is defined as 0 in ``include/ua_statuscodes.h`` along with many other return codes. It pays off to check the return code of your function calls, as we already did implicitly in the client.
+Almost all functions of the open62541 API will return a ``UA_StatusCode``, which in the C world would be represented by a ``unsigned int``. OPC UA defines large number of good and bad return codes represented by this number. The constant UA_STATUSCODE_GOOD is defined as 0 in ``include/ua_constants.h`` along with many other return codes. It pays off to check the return code of your function calls, as we already did implicitly in the client.
 
 Minimalistic introduction to OPC UA nodes and node IDs
 ------------------------------------------------------

+ 1 - 1
doc/tutorial_server_firstSteps.rst

@@ -120,7 +120,7 @@ Let's build a very rudimentary server. Create a separate folder for your applica
    │   ├── ua_nodeids.h
    │   ├── ua_server_external_ns.h
    │   ├── ua_server.h
-   │   ├── ua_statuscodes.h
+   │   ├── ua_constants.h
    │   ├── ua_transport_generated_encoding_binary.h
    │   ├── ua_transport_generated.h
    │   ├── ua_types_generated_encoding_binary.h

+ 53 - 6
include/ua_statuscodes.h

@@ -13,21 +13,68 @@
  * details.
  */
 
-#ifndef OPCUA_STATUSCODES_H_
-#define OPCUA_STATUSCODES_H_
+#ifndef UA_CONSTANTS_H_
+#define UA_CONSTANTS_H_
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /**
+ * Standard-Defined Constants
+ * ==========================
+ * This section contains numerical and string constants that are defined in the
+ * OPC UA standard.
+ *
+ * Attribute Id
+ * ------------
+ * Every node in an OPC UA information model contains attributes depending on
+ * the node type. Possible attributes are as follows: */
+typedef enum {
+    UA_ATTRIBUTEID_NODEID                  = 1,
+    UA_ATTRIBUTEID_NODECLASS               = 2,
+    UA_ATTRIBUTEID_BROWSENAME              = 3,
+    UA_ATTRIBUTEID_DISPLAYNAME             = 4,
+    UA_ATTRIBUTEID_DESCRIPTION             = 5,
+    UA_ATTRIBUTEID_WRITEMASK               = 6,
+    UA_ATTRIBUTEID_USERWRITEMASK           = 7,
+    UA_ATTRIBUTEID_ISABSTRACT              = 8,
+    UA_ATTRIBUTEID_SYMMETRIC               = 9,
+    UA_ATTRIBUTEID_INVERSENAME             = 10,
+    UA_ATTRIBUTEID_CONTAINSNOLOOPS         = 11,
+    UA_ATTRIBUTEID_EVENTNOTIFIER           = 12,
+    UA_ATTRIBUTEID_VALUE                   = 13,
+    UA_ATTRIBUTEID_DATATYPE                = 14,
+    UA_ATTRIBUTEID_VALUERANK               = 15,
+    UA_ATTRIBUTEID_ARRAYDIMENSIONS         = 16,
+    UA_ATTRIBUTEID_ACCESSLEVEL             = 17,
+    UA_ATTRIBUTEID_USERACCESSLEVEL         = 18,
+    UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL = 19,
+    UA_ATTRIBUTEID_HISTORIZING             = 20,
+    UA_ATTRIBUTEID_EXECUTABLE              = 21,
+    UA_ATTRIBUTEID_USEREXECUTABLE          = 22
+} UA_AttributeId;
+
+/**
+ * Access Level Masks
+ * ------------------
+ * The access level to a node is given by the following constants that are XORed
+ * for the overall access level. */
+#define UA_ACCESSLEVELMASK_READ 0x01
+#define UA_ACCESSLEVELMASK_WRITE 0x02
+#define UA_ACCESSLEVELMASK_HISTORYREAD 0x4
+#define UA_ACCESSLEVELMASK_HISTORYWRITE 0x08
+#define UA_ACCESSLEVELMASK_SEMANTICCHANGE 0x10
+    
+/**
+ * .. _statuscodes:
+ *
  * StatusCodes
- * ===========
+ * -----------
  * StatusCodes are extensively used in the OPC UA protocol and in the open62541
  * API. They are represented by the :ref:`statuscode` data type. The following
  * definitions are autogenerated from the ``Opc.Ua.StatusCodes.csv`` file provided
- * with the OPC UA standard.
- */
+ * with the OPC UA standard. */
 #define UA_STATUSCODE_GOOD 0x00
 #define UA_STATUSCODE_BADUNEXPECTEDERROR 0x80010000 // An unexpected error occurred.
 #define UA_STATUSCODE_BADINTERNALERROR 0x80020000 // An internal error occurred as a result of a programming or configuration error.
@@ -250,4 +297,4 @@ extern "C" {
 } // extern "C"
 #endif
 
-#endif /* UA_STATUSCODES_H_ */
+#endif /* UA_CONSTANTS_H_ */

+ 93 - 93
include/ua_types.h

@@ -26,7 +26,7 @@ extern "C" {
 #endif
 
 #include "ua_config.h"
-#include "ua_statuscodes.h"
+#include "ua_constants.h"
 
 /**
  * Data Types
@@ -39,11 +39,13 @@ extern "C" {
  * ``T``.
  *
  * ``void T_init(T *ptr)``
- *   Initialize the data type. This is synonymous with zeroing out the memory, i.e. ``memset(dataptr, 0, sizeof(T))``.
+ *   Initialize the data type. This is synonymous with zeroing out the memory,
+ *   i.e. ``memset(dataptr, 0, sizeof(T))``.
  * ``T* T_new()``
  *   Allocate and return the memory for the data type. The memory is already initialized.
  * ``UA_StatusCode T_copy(const T *src, T *dst)``
- *   Copy the content of the data type. Returns ``UA_STATUSCODE_GOOD`` or ``UA_STATUSCODE_BADOUTOFMEMORY``.
+ *   Copy the content of the data type. Returns ``UA_STATUSCODE_GOOD`` or
+ *   ``UA_STATUSCODE_BADOUTOFMEMORY``.
  * ``void T_deleteMembers(T *ptr)``
  *   Delete the dynamically allocated content of the data type, but not the data type itself.
  * ``void T_delete(T *ptr)``
@@ -146,8 +148,8 @@ typedef double UA_Double;
  *
  * StatusCode
  * ^^^^^^^^^^
- * A numeric identifier for a error or condition that is associated with a value
- * or an operation. */
+ * A numeric identifier for a error or condition that is associated with a value or an
+ * operation. See the section :ref:`statuscodes` for the meaning of a specific code. */
 typedef uint32_t UA_StatusCode;
 
 /**
@@ -167,7 +169,7 @@ typedef uint32_t UA_StatusCode;
 struct UA_DataType;
 typedef struct UA_DataType UA_DataType; 
 
-/** The following functions are used for handling arrays of an data type. */
+/** The following functions are used for handling arrays of any data type. */
 
 /* Allocates and initializes an array of variables of a specific type
  *
@@ -216,9 +218,11 @@ UA_EXPORT extern const UA_String UA_STRING_NULL;
  * ``UA_STRING`` returns a string pointing to the preallocated char-array.
  * ``UA_STRING_ALLOC`` is shorthand for ``UA_String_fromChars`` and makes a copy
  * of the char-array. */
-static UA_INLINE UA_String UA_STRING(char *chars) {
+static UA_INLINE UA_String
+UA_STRING(char *chars) {
     UA_String str; str.length = strlen(chars);
-    str.data = (UA_Byte*)chars; return str; }
+    str.data = (UA_Byte*)chars; return str;
+}
 
 #define UA_STRING_ALLOC(CHARS) UA_String_fromChars(CHARS)
 
@@ -273,9 +277,6 @@ typedef struct {
 
 UA_Boolean UA_EXPORT UA_Guid_equal(const UA_Guid *g1, const UA_Guid *g2);
 
-/* do not use for cryptographic entropy */
-UA_Guid UA_EXPORT UA_Guid_random(void);
-
 /**
  * ByteString
  * ^^^^^^^^^^
@@ -291,10 +292,14 @@ UA_StatusCode UA_EXPORT UA_ByteString_allocBuffer(UA_ByteString *bs, size_t leng
 
 UA_EXPORT extern const UA_ByteString UA_BYTESTRING_NULL;
 
-static UA_INLINE UA_ByteString UA_BYTESTRING(char *chars) {
-    UA_ByteString str; str.length = strlen(chars); str.data = (UA_Byte*)chars; return str; }
+static UA_INLINE UA_ByteString
+UA_BYTESTRING(char *chars) {
+    UA_ByteString str; str.length = strlen(chars);
+    str.data = (UA_Byte*)chars; return str;
+}
 
-static UA_INLINE UA_ByteString UA_BYTESTRING_ALLOC(const char *chars) {
+static UA_INLINE UA_ByteString
+UA_BYTESTRING_ALLOC(const char *chars) {
     UA_String str = UA_String_fromChars(chars); UA_ByteString bstr;
     bstr.length = str.length; bstr.data = str.data; return bstr;
 }
@@ -310,9 +315,8 @@ typedef UA_String UA_XmlElement;
  * ^^^^^^
  * An identifier for a node in the address space of an OPC UA Server. */
 enum UA_NodeIdType {
-    UA_NODEIDTYPE_NUMERIC    = 0, /* In the binary encoding, this can become 0
-                                     or 1 for 2byte and 4byte encoding of small
-                                     nodeids. */
+    UA_NODEIDTYPE_NUMERIC    = 0, /* In the binary encoding, this can also become 1 or 2
+                                     (2byte and 4byte encoding of small numeric nodeids) */
     UA_NODEIDTYPE_STRING     = 3,
     UA_NODEIDTYPE_GUID       = 4,
     UA_NODEIDTYPE_BYTESTRING = 5
@@ -331,37 +335,57 @@ typedef struct {
 
 UA_EXPORT extern const UA_NodeId UA_NODEID_NULL;
 
-static UA_INLINE UA_Boolean UA_NodeId_isNull(const UA_NodeId *p) {
-    return (p->namespaceIndex == 0 && p->identifierType == UA_NODEIDTYPE_NUMERIC &&
+static UA_INLINE UA_Boolean
+UA_NodeId_isNull(const UA_NodeId *p) {
+    return (p->namespaceIndex == 0 &&
+            p->identifierType == UA_NODEIDTYPE_NUMERIC &&
             p->identifier.numeric == 0);
 }
 
 UA_Boolean UA_EXPORT UA_NodeId_equal(const UA_NodeId *n1, const UA_NodeId *n2);
 
 /** The following functions are shorthand for creating NodeIds. */
-static UA_INLINE UA_NodeId UA_NODEID_NUMERIC(UA_UInt16 nsIndex, UA_UInt32 identifier) {
-    UA_NodeId id; id.namespaceIndex = nsIndex; id.identifierType = UA_NODEIDTYPE_NUMERIC;
-    id.identifier.numeric = identifier; return id; }
+static UA_INLINE UA_NodeId
+UA_NODEID_NUMERIC(UA_UInt16 nsIndex, UA_UInt32 identifier) {
+    UA_NodeId id; id.namespaceIndex = nsIndex;
+    id.identifierType = UA_NODEIDTYPE_NUMERIC;
+    id.identifier.numeric = identifier; return id;
+}
 
-static UA_INLINE UA_NodeId UA_NODEID_STRING(UA_UInt16 nsIndex, char *chars) {
-    UA_NodeId id; id.namespaceIndex = nsIndex; id.identifierType = UA_NODEIDTYPE_STRING;
-    id.identifier.string = UA_STRING(chars); return id; }
+static UA_INLINE UA_NodeId
+UA_NODEID_STRING(UA_UInt16 nsIndex, char *chars) {
+    UA_NodeId id; id.namespaceIndex = nsIndex;
+    id.identifierType = UA_NODEIDTYPE_STRING;
+    id.identifier.string = UA_STRING(chars); return id;
+}
 
-static UA_INLINE UA_NodeId UA_NODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars) {
-    UA_NodeId id; id.namespaceIndex = nsIndex; id.identifierType = UA_NODEIDTYPE_STRING;
-    id.identifier.string = UA_STRING_ALLOC(chars); return id; }
+static UA_INLINE UA_NodeId
+UA_NODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars) {
+    UA_NodeId id; id.namespaceIndex = nsIndex;
+    id.identifierType = UA_NODEIDTYPE_STRING;
+    id.identifier.string = UA_STRING_ALLOC(chars); return id;
+}
 
-static UA_INLINE UA_NodeId UA_NODEID_GUID(UA_UInt16 nsIndex, UA_Guid guid) {
-    UA_NodeId id; id.namespaceIndex = nsIndex; id.identifierType = UA_NODEIDTYPE_GUID;
-    id.identifier.guid = guid; return id; }
+static UA_INLINE UA_NodeId
+UA_NODEID_GUID(UA_UInt16 nsIndex, UA_Guid guid) {
+    UA_NodeId id; id.namespaceIndex = nsIndex;
+    id.identifierType = UA_NODEIDTYPE_GUID;
+    id.identifier.guid = guid; return id;
+}
 
-static UA_INLINE UA_NodeId UA_NODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars) {
-    UA_NodeId id; id.namespaceIndex = nsIndex; id.identifierType = UA_NODEIDTYPE_BYTESTRING;
-    id.identifier.byteString = UA_BYTESTRING(chars); return id; }
+static UA_INLINE UA_NodeId
+UA_NODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars) {
+    UA_NodeId id; id.namespaceIndex = nsIndex;
+    id.identifierType = UA_NODEIDTYPE_BYTESTRING;
+    id.identifier.byteString = UA_BYTESTRING(chars); return id;
+}
 
-static UA_INLINE UA_NodeId UA_NODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex, const char *chars) {
-    UA_NodeId id; id.namespaceIndex = nsIndex; id.identifierType = UA_NODEIDTYPE_BYTESTRING;
-    id.identifier.byteString = UA_BYTESTRING_ALLOC(chars); return id; }
+static UA_INLINE UA_NodeId
+UA_NODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex, const char *chars) {
+    UA_NodeId id; id.namespaceIndex = nsIndex;
+    id.identifierType = UA_NODEIDTYPE_BYTESTRING;
+    id.identifier.byteString = UA_BYTESTRING_ALLOC(chars); return id;
+}
 
 /**
  * ExpandedNodeId
@@ -377,32 +401,38 @@ typedef struct {
 static UA_INLINE UA_ExpandedNodeId
 UA_EXPANDEDNODEID_NUMERIC(UA_UInt16 nsIndex, UA_UInt32 identifier) {
     UA_ExpandedNodeId id; id.nodeId = UA_NODEID_NUMERIC(nsIndex, identifier);
-    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; }
+    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
+}
 
 static UA_INLINE UA_ExpandedNodeId
 UA_EXPANDEDNODEID_STRING(UA_UInt16 nsIndex, char *chars) {
     UA_ExpandedNodeId id; id.nodeId = UA_NODEID_STRING(nsIndex, chars);
-    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; }
+    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
+}
 
 static UA_INLINE UA_ExpandedNodeId
 UA_EXPANDEDNODEID_STRING_ALLOC(UA_UInt16 nsIndex, const char *chars) {
     UA_ExpandedNodeId id; id.nodeId = UA_NODEID_STRING_ALLOC(nsIndex, chars);
-    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; }
+    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
+}
 
 static UA_INLINE UA_ExpandedNodeId
 UA_EXPANDEDNODEID_STRING_GUID(UA_UInt16 nsIndex, UA_Guid guid) {
     UA_ExpandedNodeId id; id.nodeId = UA_NODEID_GUID(nsIndex, guid);
-    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; }
+    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
+}
 
 static UA_INLINE UA_ExpandedNodeId
 UA_EXPANDEDNODEID_BYTESTRING(UA_UInt16 nsIndex, char *chars) {
     UA_ExpandedNodeId id; id.nodeId = UA_NODEID_BYTESTRING(nsIndex, chars);
-    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; }
+    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
+}
 
 static UA_INLINE UA_ExpandedNodeId
 UA_EXPANDEDNODEID_BYTESTRING_ALLOC(UA_UInt16 nsIndex, const char *chars) {
     UA_ExpandedNodeId id; id.nodeId = UA_NODEID_BYTESTRING_ALLOC(nsIndex, chars);
-    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id; }
+    id.serverIndex = 0; id.namespaceUri = UA_STRING_NULL; return id;
+}
 
 /**
  * QualifiedName
@@ -416,12 +446,14 @@ typedef struct {
 static UA_INLINE UA_QualifiedName
 UA_QUALIFIEDNAME(UA_UInt16 nsIndex, char *chars) {
     UA_QualifiedName qn; qn.namespaceIndex = nsIndex;
-    qn.name = UA_STRING(chars); return qn; }
+    qn.name = UA_STRING(chars); return qn;
+}
 
 static UA_INLINE UA_QualifiedName
 UA_QUALIFIEDNAME_ALLOC(UA_UInt16 nsIndex, const char *chars) {
     UA_QualifiedName qn; qn.namespaceIndex = nsIndex;
-    qn.name = UA_STRING_ALLOC(chars); return qn; }
+    qn.name = UA_STRING_ALLOC(chars); return qn;
+}
 
 /**
  * LocalizedText
@@ -435,12 +467,14 @@ typedef struct {
 static UA_INLINE UA_LocalizedText
 UA_LOCALIZEDTEXT(char *locale, char *text) {
     UA_LocalizedText lt; lt.locale = UA_STRING(locale);
-    lt.text = UA_STRING(text); return lt; }
+    lt.text = UA_STRING(text); return lt;
+}
 
 static UA_INLINE UA_LocalizedText
 UA_LOCALIZEDTEXT_ALLOC(const char *locale, const char *text) {
     UA_LocalizedText lt; lt.locale = UA_STRING_ALLOC(locale);
-    lt.text = UA_STRING_ALLOC(text); return lt; }
+    lt.text = UA_STRING_ALLOC(text); return lt;
+}
 
 /**
  * ExtensionObject
@@ -512,8 +546,10 @@ typedef struct {
  *
  * @param v The variant
  * @return Does the variant contain a scalar value. */
-static UA_INLINE UA_Boolean UA_Variant_isScalar(const UA_Variant *v) {
-    return (v->arrayLength == 0 && v->data > UA_EMPTY_ARRAY_SENTINEL); }
+static UA_INLINE UA_Boolean
+UA_Variant_isScalar(const UA_Variant *v) {
+    return (v->arrayLength == 0 && v->data > UA_EMPTY_ARRAY_SENTINEL);
+}
     
 /* Set the variant to a scalar value that already resides in memory. The value takes on
  * the lifecycle of the variant and is deleted with it.
@@ -521,16 +557,14 @@ static UA_INLINE UA_Boolean UA_Variant_isScalar(const UA_Variant *v) {
  * @param v The variant
  * @param p A pointer to the value data
  * @param type The datatype of the value in question */
-void UA_EXPORT
-UA_Variant_setScalar(UA_Variant *v, void * UA_RESTRICT p, const UA_DataType *type);
+void UA_EXPORT UA_Variant_setScalar(UA_Variant *v, void * UA_RESTRICT p, const UA_DataType *type);
 
 /* Set the variant to a scalar value that is copied from an existing variable.
  * @param v The variant
  * @param p A pointer to the value data
  * @param type The datatype of the value
  * @return Indicates whether the operation succeeded or returns an error code */
-UA_StatusCode UA_EXPORT
-UA_Variant_setScalarCopy(UA_Variant *v, const void *p, const UA_DataType *type);
+UA_StatusCode UA_EXPORT UA_Variant_setScalarCopy(UA_Variant *v, const void *p, const UA_DataType *type);
 
 /* Set the variant to an array that already resides in memory. The array takes on the
  * lifecycle of the variant and is deleted with it.
@@ -696,7 +730,9 @@ void UA_EXPORT * UA_new(const UA_DataType *type) UA_FUNC_ATTR_MALLOC;
  * @param p The memory location of the variable
  * @param type The datatype description */
 static UA_INLINE void
-UA_init(void *p, const UA_DataType *type) { memset(p, 0, type->memSize); }
+UA_init(void *p, const UA_DataType *type) {
+    memset(p, 0, type->memSize);
+}
 
 /* Copies the content of two variables. If copying fails (e.g. because no memory was
  * available for an array), then dst is emptied and initialized to prevent memory leaks.
@@ -722,50 +758,14 @@ void UA_EXPORT UA_deleteMembers(void *p, const UA_DataType *type);
  * @param type The datatype description of the variable */
 void UA_EXPORT UA_delete(void *p, const UA_DataType *type);
 
-/**
- * Standard-defined constants
- * --------------------------
- * These are not generated from XML. Server *and* client need them. */
-typedef enum {
-    UA_ATTRIBUTEID_NODEID                  = 1,
-    UA_ATTRIBUTEID_NODECLASS               = 2,
-    UA_ATTRIBUTEID_BROWSENAME              = 3,
-    UA_ATTRIBUTEID_DISPLAYNAME             = 4,
-    UA_ATTRIBUTEID_DESCRIPTION             = 5,
-    UA_ATTRIBUTEID_WRITEMASK               = 6,
-    UA_ATTRIBUTEID_USERWRITEMASK           = 7,
-    UA_ATTRIBUTEID_ISABSTRACT              = 8,
-    UA_ATTRIBUTEID_SYMMETRIC               = 9,
-    UA_ATTRIBUTEID_INVERSENAME             = 10,
-    UA_ATTRIBUTEID_CONTAINSNOLOOPS         = 11,
-    UA_ATTRIBUTEID_EVENTNOTIFIER           = 12,
-    UA_ATTRIBUTEID_VALUE                   = 13,
-    UA_ATTRIBUTEID_DATATYPE                = 14,
-    UA_ATTRIBUTEID_VALUERANK               = 15,
-    UA_ATTRIBUTEID_ARRAYDIMENSIONS         = 16,
-    UA_ATTRIBUTEID_ACCESSLEVEL             = 17,
-    UA_ATTRIBUTEID_USERACCESSLEVEL         = 18,
-    UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL = 19,
-    UA_ATTRIBUTEID_HISTORIZING             = 20,
-    UA_ATTRIBUTEID_EXECUTABLE              = 21,
-    UA_ATTRIBUTEID_USEREXECUTABLE          = 22
-} UA_AttributeId;
-
-typedef enum {
-    UA_ACCESSLEVELMASK_READ = 0x01,
-    UA_ACCESSLEVELMASK_WRITE = 0x02,
-    UA_ACCESSLEVELMASK_HISTORYREAD = 0x4,
-    UA_ACCESSLEVELMASK_HISTORYWRITE = 0x08,
-    UA_ACCESSLEVELMASK_SEMANTICCHANGE = 0x10
-} UA_AccessLevelMask;
-
 /**
  * Random Number Generator
  * -----------------------
  * If UA_ENABLE_MULTITHREADING is defined, then the seed is stored in thread local
  * storage. The seed is initialized for every thread in the server/client. */
-UA_EXPORT void UA_random_seed(UA_UInt64 seed);
-UA_EXPORT UA_UInt32 UA_UInt32_random(void); /* do not use for cryptographic entropy */
+void UA_EXPORT UA_random_seed(UA_UInt64 seed);
+UA_UInt32 UA_EXPORT UA_UInt32_random(void); /* do not use for cryptographic entropy */
+UA_Guid UA_EXPORT UA_Guid_random(void); /* do not use for cryptographic entropy */
 
 #ifdef __cplusplus
 } // extern "C"

+ 2 - 2
src/server/ua_nodestore.c

@@ -1,7 +1,7 @@
+#include <stdio.h>
+
 #include "ua_nodestore.h"
 #include "ua_util.h"
-#include "ua_statuscodes.h"
-#include <stdio.h>
 
 #define UA_NODESTORE_MINSIZE 64
 

+ 0 - 4
src/server/ua_services_attribute.c

@@ -1,9 +1,5 @@
 #include "ua_server_internal.h"
-#include "ua_types_generated.h"
 #include "ua_services.h"
-#include "ua_statuscodes.h"
-#include "ua_nodestore.h"
-#include "ua_util.h"
 
 /******************/
 /* Read Attribute */

+ 0 - 4
src/server/ua_services_call.c

@@ -1,9 +1,5 @@
 #include "ua_services.h"
 #include "ua_server_internal.h"
-#include "ua_statuscodes.h"
-#include "ua_util.h"
-#include "ua_nodestore.h"
-#include "ua_nodes.h"
 
 static const UA_VariableNode *
 getArgumentsVariableNode(UA_Server *server, const UA_MethodNode *ofMethod,

+ 0 - 5
src/server/ua_services_nodemanagement.c

@@ -1,10 +1,5 @@
-#include "ua_util.h"
 #include "ua_server_internal.h"
 #include "ua_services.h"
-#include "ua_statuscodes.h"
-#include "ua_nodestore.h"
-#include "ua_session.h"
-#include "ua_types_generated_encoding_binary.h"
 
 /************/
 /* Add Node */

+ 1 - 4
src/server/ua_services_subscription.c

@@ -1,10 +1,7 @@
-#include "ua_services.h"
 #include "ua_server_internal.h"
+#include "ua_services.h"
 #include "ua_subscription_manager.h"
 #include "ua_subscription.h"
-#include "ua_statuscodes.h"
-#include "ua_util.h"
-#include "ua_nodestore.h"
 
 #define UA_BOUNDEDVALUE_SETWBOUNDS(BOUNDS, SRC, DST) { \
     if(SRC > BOUNDS.maxValue) DST = BOUNDS.maxValue; \

+ 0 - 3
src/server/ua_services_view.c

@@ -1,8 +1,5 @@
 #include "ua_server_internal.h"
 #include "ua_services.h"
-#include "ua_statuscodes.h"
-#include "ua_nodestore.h"
-#include "ua_util.h"
 
 static UA_StatusCode
 fillReferenceDescription(UA_NodeStore *ns, const UA_Node *curr, UA_ReferenceNode *ref,

+ 1 - 2
src/ua_session.c

@@ -1,6 +1,5 @@
-#include "ua_util.h"
 #include "ua_session.h"
-#include "ua_statuscodes.h"
+#include "ua_util.h"
 
 UA_Session adminSession = {
     .clientDescription =  {.applicationUri = {0, NULL}, .productUri = {0, NULL},

+ 0 - 3
src/ua_types.c

@@ -1,6 +1,5 @@
 #include "ua_util.h"
 #include "ua_types.h"
-#include "ua_statuscodes.h"
 #include "ua_types_generated.h"
 
 #include "pcg_basic.h"
@@ -17,7 +16,6 @@ UA_EXPORT const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL = {
 /***************************/
 /* Random Number Generator */
 /***************************/
-
 static UA_THREAD_LOCAL pcg32_random_t UA_rng = PCG32_INITIALIZER;
 
 UA_EXPORT void UA_random_seed(UA_UInt64 seed) {
@@ -27,7 +25,6 @@ UA_EXPORT void UA_random_seed(UA_UInt64 seed) {
 /*****************/
 /* Builtin Types */
 /*****************/
-
 UA_EXPORT UA_UInt32 UA_UInt32_random(void) {
     return (UA_UInt32)pcg32_random_r(&UA_rng);
 }

+ 1 - 2
src/ua_types_encoding_binary.c

@@ -1,7 +1,6 @@
-#include "ua_util.h"
 #include "ua_types_encoding_binary.h"
-#include "ua_statuscodes.h"
 #include "ua_types_generated.h"
+#include "ua_util.h"
 
 /* All de- and encoding functions have the same signature up to the pointer type.
    So we can use a jump-table to switch into member types. */

+ 0 - 2
tests/check_services_attributes.c

@@ -7,9 +7,7 @@
 #include "server/ua_services.h"
 #include "ua_client.h"
 #include "ua_nodeids.h"
-#include "ua_statuscodes.h"
 #include "ua_types.h"
-#include "ua_util.h"
 #include "server/ua_server_internal.h"
 
 #ifdef UA_ENABLE_MULTITHREADING

+ 0 - 2
tests/check_services_nodemanagement.c

@@ -7,9 +7,7 @@
 #include "server/ua_services.h"
 #include "ua_client.h"
 #include "ua_nodeids.h"
-#include "ua_statuscodes.h"
 #include "ua_types.h"
-#include "ua_util.h"
 #include "server/ua_server_internal.h"
 
 #ifdef UA_ENABLE_MULTITHREADING

+ 0 - 1
tests/check_services_view.c

@@ -3,7 +3,6 @@
 
 #include "ua_types.h"
 #include "server/ua_services.h"
-#include "ua_statuscodes.h"
 #include "check.h"
 
 /* START_TEST(Service_TranslateBrowsePathsToNodeIds_SmokeTest)

+ 0 - 20
tests/check_session.c

@@ -1,27 +1,15 @@
-/*
- * check_session.c
- *
- *  Created on: Jul 30, 2015
- *      Author: opcua
- */
-
-
 #include <stdio.h>
 #include <stdlib.h>
 
 #include "ua_types.h"
 #include "server/ua_services.h"
-#include "ua_statuscodes.h"
 #include "check.h"
-#include "ua_util.h"
-
 
 START_TEST(Session_init_ShallWork)
 {
 	UA_Session session;
 	UA_Session_init(&session);
 
-
     UA_NodeId tmpNodeId;
     UA_NodeId_init(&tmpNodeId);
     UA_ApplicationDescription tmpAppDescription;
@@ -40,9 +28,6 @@ START_TEST(Session_init_ShallWork)
     ck_assert_ptr_eq(session.sessionName.data,NULL);
     ck_assert_int_eq((int)session.timeout,0);
     ck_assert_int_eq(session.validTill,tmpDateTime);
-
-
-	//finally
 }
 END_TEST
 
@@ -55,12 +40,7 @@ START_TEST(Session_updateLifetime_ShallWork)
 	UA_Session_updateLifetime(&session);
 
 	UA_Int32 result = (session.validTill > tmpDateTime);
-
 	ck_assert_int_gt(result,0);
-
-
-
-	//finally
 }
 END_TEST