Bläddra i källkod

improve documentation; limit code width to 80 chars in headers

Julius Pfrommer 7 år sedan
förälder
incheckning
df2a0c6007
5 ändrade filer med 432 tillägg och 257 borttagningar
  1. 0 2
      doc/index.rst
  2. 118 70
      include/ua_client.h
  3. 7 10
      include/ua_client_highlevel.h
  4. 221 118
      include/ua_server.h
  5. 86 57
      include/ua_types.h

+ 0 - 2
doc/index.rst

@@ -27,6 +27,4 @@ standard.
    constants
    server
    client
-   client_highlevel
    internal
-

+ 118 - 70
include/ua_client.h

@@ -44,13 +44,14 @@ extern "C" {
  *
  * Client Configuration
  * -------------------- */
-typedef UA_Connection (*UA_ConnectClientConnection)(UA_ConnectionConfig localConf,
-                                                    const char *endpointUrl,
-                                                    UA_Logger logger);
+typedef UA_Connection
+(*UA_ConnectClientConnection)(UA_ConnectionConfig localConf,
+                              const char *endpointUrl, UA_Logger logger);
 
 typedef struct UA_ClientConfig {
-    UA_UInt32 timeout; //sync response timeout
-    UA_UInt32 secureChannelLifeTime; // lifetime in ms (then the channel needs to be renewed)
+    UA_UInt32 timeout;               /* Sync response timeout */
+    UA_UInt32 secureChannelLifeTime; /* Lifetime in ms (then the channel needs
+                                        to be renewed) */
     UA_Logger logger;
     UA_ConnectionConfig localConnectionConfig;
     UA_ConnectClientConnection connectionFunc;
@@ -60,17 +61,17 @@ typedef struct UA_ClientConfig {
  * Client Lifecycle
  * ---------------- */
 typedef enum {
-     UA_CLIENTSTATE_READY,     /* The client is not connected but initialized and ready to
-                                  use. */
+     UA_CLIENTSTATE_READY,     /* The client is not connected but initialized
+                                  and ready to use. */
      UA_CLIENTSTATE_CONNECTED, /* The client is connected to a server. */
-     UA_CLIENTSTATE_FAULTED,   /* An error has occured that might have influenced the
-                                  connection state. A successfull service call or renewal
-                                  of the secure channel will reset the state to
-                                  CONNECTED. */
-     UA_CLIENTSTATE_ERRORED    /* A non-recoverable error has occured and the connection
-                                  is no longer reliable. The client needs to be
-                                  disconnected and reinitialized to recover into a
-                                  CONNECTED state. */
+     UA_CLIENTSTATE_FAULTED,   /* An error has occured that might have
+                                  influenced the connection state. A successfull
+                                  service call or renewal of the secure channel
+                                  will reset the state to CONNECTED. */
+     UA_CLIENTSTATE_ERRORED    /* A non-recoverable error has occured and the
+                                  connection is no longer reliable. The client
+                                  needs to be disconnected and reinitialized to
+                                  recover into a CONNECTED state. */
 } UA_ClientState;
 
 struct UA_Client;
@@ -78,9 +79,10 @@ typedef struct UA_Client UA_Client;
 
 /* Create a new client
  *
- * @param config for the new client. You can use UA_ClientConfig_standard which has sane defaults
- * @param logger function pointer to a logger function. See examples/logger_stdout.c for a simple
- *               implementation
+ * @param config for the new client. You can use UA_ClientConfig_standard
+ *        which has sane defaults
+ * @param logger function pointer to a logger function. See
+ *        examples/logger_stdout.c for a simple implementation
  * @return return the new Client object */
 UA_Client UA_EXPORT * UA_Client_new(UA_ClientConfig config);
 
@@ -101,7 +103,8 @@ void UA_EXPORT UA_Client_delete(UA_Client *client);
  * @param client to use
  * @param server url to connect (for example "opc.tcp://localhost:16664")
  * @param endpointDescriptionsSize size of the array of endpoint descriptions
- * @param endpointDescriptions array of endpoint descriptions that is allocated by the function (you need to free manually)
+ * @param endpointDescriptions array of endpoint descriptions that is allocated
+ *        by the function (you need to free manually)
  * @return Indicates whether the operation succeeded or returns an error code */
 UA_StatusCode UA_EXPORT
 UA_Client_getEndpoints(UA_Client *client, const char *serverUrl,
@@ -138,12 +141,14 @@ UA_StatusCode UA_EXPORT UA_Client_manuallyRenewSecureChannel(UA_Client *client);
  *
  * Raw Services
  * ------------
- * The raw OPC UA services are exposed to the client. But most of them time, it is better to use the
- * convenience functions from ``ua_client_highlevel.h`` that wrap the raw services. */
+ * The raw OPC UA services are exposed to the client. But most of them time, it
+ * is better to use the convenience functions from ``ua_client_highlevel.h``
+ * that wrap the raw services. */
 /* Don't use this function. Use the type versions below instead. */
 void UA_EXPORT
-__UA_Client_Service(UA_Client *client, const void *request, const UA_DataType *requestType,
-                    void *response, const UA_DataType *responseType);
+__UA_Client_Service(UA_Client *client, const void *request,
+                    const UA_DataType *requestType, void *response,
+                    const UA_DataType *responseType);
 
 /**
  * Attribute Service Set
@@ -153,14 +158,16 @@ UA_Client_Service_read(UA_Client *client, const UA_ReadRequest request) {
     UA_ReadResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_READREQUEST],
                         &response, &UA_TYPES[UA_TYPES_READRESPONSE]);
-    return response; }
+    return response;
+}
 
 static UA_INLINE UA_WriteResponse
 UA_Client_Service_write(UA_Client *client, const UA_WriteRequest request) {
     UA_WriteResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_WRITEREQUEST],
                         &response, &UA_TYPES[UA_TYPES_WRITERESPONSE]);
-    return response; }
+    return response;
+}
 
 /**
  * Method Service Set
@@ -170,7 +177,8 @@ UA_Client_Service_call(UA_Client *client, const UA_CallRequest request) {
     UA_CallResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_CALLREQUEST],
                         &response, &UA_TYPES[UA_TYPES_CALLRESPONSE]);
-    return response; }
+    return response;
+}
 
 /**
  * NodeManagement Service Set
@@ -180,28 +188,35 @@ UA_Client_Service_addNodes(UA_Client *client, const UA_AddNodesRequest request)
     UA_AddNodesResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_ADDNODESREQUEST],
                         &response, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE]);
-    return response; }
+    return response;
+}
 
 static UA_INLINE UA_AddReferencesResponse
-UA_Client_Service_addReferences(UA_Client *client, const UA_AddReferencesRequest request) {
+UA_Client_Service_addReferences(UA_Client *client,
+                                const UA_AddReferencesRequest request) {
     UA_AddReferencesResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_ADDNODESREQUEST],
                         &response, &UA_TYPES[UA_TYPES_ADDNODESRESPONSE]);
-    return response; }
+    return response;
+}
 
 static UA_INLINE UA_DeleteNodesResponse
-UA_Client_Service_deleteNodes(UA_Client *client, const UA_DeleteNodesRequest request) {
+UA_Client_Service_deleteNodes(UA_Client *client,
+                              const UA_DeleteNodesRequest request) {
     UA_DeleteNodesResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_DELETENODESREQUEST],
                         &response, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE]);
-    return response; }
+    return response;
+}
 
 static UA_INLINE UA_DeleteReferencesResponse
-UA_Client_Service_deleteReferences(UA_Client *client, const UA_DeleteReferencesRequest request) {
+UA_Client_Service_deleteReferences(UA_Client *client,
+                                   const UA_DeleteReferencesRequest request) {
     UA_DeleteReferencesResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_DELETENODESREQUEST],
                         &response, &UA_TYPES[UA_TYPES_DELETENODESRESPONSE]);
-    return response; }
+    return response;
+}
 
 /**
  * View Service Set
@@ -211,53 +226,68 @@ UA_Client_Service_browse(UA_Client *client, const UA_BrowseRequest request) {
     UA_BrowseResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_BROWSEREQUEST],
                         &response, &UA_TYPES[UA_TYPES_BROWSERESPONSE]);
-    return response; }
+    return response;
+}
 
 static UA_INLINE UA_BrowseNextResponse
-UA_Client_Service_browseNext(UA_Client *client, const UA_BrowseNextRequest request) {
+UA_Client_Service_browseNext(UA_Client *client,
+                             const UA_BrowseNextRequest request) {
     UA_BrowseNextResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_BROWSENEXTREQUEST],
                         &response, &UA_TYPES[UA_TYPES_BROWSENEXTRESPONSE]);
-    return response; }
+    return response;
+}
 
 static UA_INLINE UA_TranslateBrowsePathsToNodeIdsResponse
 UA_Client_Service_translateBrowsePathsToNodeIds(UA_Client *client,
-                                                const UA_TranslateBrowsePathsToNodeIdsRequest request) {
+                        const UA_TranslateBrowsePathsToNodeIdsRequest request) {
     UA_TranslateBrowsePathsToNodeIdsResponse response;
-    __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST],
-                        &response, &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE]);
-    return response; }
+    __UA_Client_Service(client, &request,
+                        &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSREQUEST],
+                        &response,
+                        &UA_TYPES[UA_TYPES_TRANSLATEBROWSEPATHSTONODEIDSRESPONSE]);
+    return response;
+}
 
 static UA_INLINE UA_RegisterNodesResponse
-UA_Client_Service_registerNodes(UA_Client *client, const UA_RegisterNodesRequest request) {
+UA_Client_Service_registerNodes(UA_Client *client,
+                                const UA_RegisterNodesRequest request) {
     UA_RegisterNodesResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_REGISTERNODESREQUEST],
                         &response, &UA_TYPES[UA_TYPES_REGISTERNODESRESPONSE]);
-    return response; }
+    return response;
+}
 
 static UA_INLINE UA_UnregisterNodesResponse
-UA_Client_Service_unregisterNodes(UA_Client *client, const UA_UnregisterNodesRequest request) {
+UA_Client_Service_unregisterNodes(UA_Client *client,
+                                  const UA_UnregisterNodesRequest request) {
     UA_UnregisterNodesResponse response;
-    __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST],
+    __UA_Client_Service(client, &request,
+                        &UA_TYPES[UA_TYPES_UNREGISTERNODESREQUEST],
                         &response, &UA_TYPES[UA_TYPES_UNREGISTERNODESRESPONSE]);
-    return response; }
+    return response;
+}
 
 /**
  * Query Service Set
  * ^^^^^^^^^^^^^^^^^ */
 static UA_INLINE UA_QueryFirstResponse
-UA_Client_Service_queryFirst(UA_Client *client, const UA_QueryFirstRequest request) {
+UA_Client_Service_queryFirst(UA_Client *client,
+                             const UA_QueryFirstRequest request) {
     UA_QueryFirstResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST],
                         &response, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]);
-    return response; }
+    return response;
+}
 
 static UA_INLINE UA_QueryNextResponse
-UA_Client_Service_queryNext(UA_Client *client, const UA_QueryNextRequest request) {
+UA_Client_Service_queryNext(UA_Client *client,
+                            const UA_QueryNextRequest request) {
     UA_QueryNextResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_QUERYFIRSTREQUEST],
                         &response, &UA_TYPES[UA_TYPES_QUERYFIRSTRESPONSE]);
-    return response; }
+    return response;
+}
 
 #ifdef UA_ENABLE_SUBSCRIPTIONS
 
@@ -265,52 +295,70 @@ UA_Client_Service_queryNext(UA_Client *client, const UA_QueryNextRequest request
  * MonitoredItem Service Set
  * ^^^^^^^^^^^^^^^^^^^^^^^^^ */
 static UA_INLINE UA_CreateMonitoredItemsResponse
-UA_Client_Service_createMonitoredItems(UA_Client *client, const UA_CreateMonitoredItemsRequest request) {
+UA_Client_Service_createMonitoredItems(UA_Client *client,
+                                 const UA_CreateMonitoredItemsRequest request) {
     UA_CreateMonitoredItemsResponse response;
-    __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST],
-                        &response, &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE]);
-    return response; }
+    __UA_Client_Service(client, &request,
+                        &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSREQUEST], &response,
+                        &UA_TYPES[UA_TYPES_CREATEMONITOREDITEMSRESPONSE]);
+    return response;
+}
 
 static UA_INLINE UA_DeleteMonitoredItemsResponse
-UA_Client_Service_deleteMonitoredItems(UA_Client *client, const UA_DeleteMonitoredItemsRequest request) {
+UA_Client_Service_deleteMonitoredItems(UA_Client *client,
+                                 const UA_DeleteMonitoredItemsRequest request) {
     UA_DeleteMonitoredItemsResponse response;
-    __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST],
-                        &response, &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE]);
-    return response; }
+    __UA_Client_Service(client, &request,
+                        &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSREQUEST], &response,
+                        &UA_TYPES[UA_TYPES_DELETEMONITOREDITEMSRESPONSE]);
+    return response;
+}
 
 /**
  * Subscription Service Set
  * ^^^^^^^^^^^^^^^^^^^^^^^^ */
 static UA_INLINE UA_CreateSubscriptionResponse
-UA_Client_Service_createSubscription(UA_Client *client, const UA_CreateSubscriptionRequest request) {
+UA_Client_Service_createSubscription(UA_Client *client,
+                                   const UA_CreateSubscriptionRequest request) {
     UA_CreateSubscriptionResponse response;
-    __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST],
-                        &response, &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]);
-    return response; }
+    __UA_Client_Service(client, &request,
+                        &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONREQUEST], &response,
+                        &UA_TYPES[UA_TYPES_CREATESUBSCRIPTIONRESPONSE]);
+    return response;
+}
 
 static UA_INLINE UA_ModifySubscriptionResponse
-UA_Client_Service_modifySubscription(UA_Client *client, const UA_ModifySubscriptionRequest request) {
+UA_Client_Service_modifySubscription(UA_Client *client,
+                                   const UA_ModifySubscriptionRequest request) {
     UA_ModifySubscriptionResponse response;
-    __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST],
-                        &response, &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]);
-    return response; }
+    __UA_Client_Service(client, &request,
+                        &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONREQUEST], &response,
+                        &UA_TYPES[UA_TYPES_MODIFYSUBSCRIPTIONRESPONSE]);
+    return response;
+}
 
 static UA_INLINE UA_DeleteSubscriptionsResponse
-UA_Client_Service_deleteSubscriptions(UA_Client *client, const UA_DeleteSubscriptionsRequest request) {
+UA_Client_Service_deleteSubscriptions(UA_Client *client,
+                                  const UA_DeleteSubscriptionsRequest request) {
     UA_DeleteSubscriptionsResponse response;
-    __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST],
-                        &response, &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE]);
-    return response; }
+    __UA_Client_Service(client, &request,
+                        &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSREQUEST], &response,
+                        &UA_TYPES[UA_TYPES_DELETESUBSCRIPTIONSRESPONSE]);
+    return response;
+}
 
 static UA_INLINE UA_PublishResponse
 UA_Client_Service_publish(UA_Client *client, const UA_PublishRequest request) {
     UA_PublishResponse response;
     __UA_Client_Service(client, &request, &UA_TYPES[UA_TYPES_PUBLISHREQUEST],
                         &response, &UA_TYPES[UA_TYPES_PUBLISHRESPONSE]);
-    return response; }
+    return response;
+}
 
 #endif
 
+/** .. include:: client_highlevel.rst */
+
 #ifdef __cplusplus
 } // extern "C"
 #endif

+ 7 - 10
include/ua_client_highlevel.h

@@ -42,7 +42,7 @@ extern "C" {
  * using the raw :ref:`OPC UA services <client-services>`.
  *
  * Read Attributes
- * ===============
+ * ^^^^^^^^^^^^^^^
  * The following functions can be used to retrieve a single node attribute. Use
  * the regular service to read several attributes at once. */
 /* Don't call this function, use the typed versions */
@@ -220,7 +220,7 @@ UA_Client_readUserExecutableAttribute(UA_Client *client, const UA_NodeId nodeId,
 
 /**
  * Write Attributes
- * ================
+ * ^^^^^^^^^^^^^^^^
  * The following functions can be use to write a single node attribute at a
  * time. Use the regular write service to write several attributes at once. */
 /* Don't call this function, use the typed versions */
@@ -399,7 +399,7 @@ UA_Client_writeUserExecutableAttribute(UA_Client *client, const UA_NodeId nodeId
 
 /**
  * Method Calling
- * ============== */
+ * ^^^^^^^^^^^^^^ */
 UA_StatusCode UA_EXPORT
 UA_Client_call(UA_Client *client, const UA_NodeId objectId,
                const UA_NodeId methodId, size_t inputSize, const UA_Variant *input,
@@ -407,10 +407,8 @@ UA_Client_call(UA_Client *client, const UA_NodeId objectId,
 
 /**
  * Node Management
- * ===============
- *
- * See the section on :ref:`server-side node management <addnodes>`.
- */
+ * ^^^^^^^^^^^^^^^
+ * See the section on :ref:`server-side node management <addnodes>`. */
 UA_StatusCode UA_EXPORT
 UA_Client_addReference(UA_Client *client, const UA_NodeId sourceNodeId,
                        const UA_NodeId referenceTypeId, UA_Boolean isForward,
@@ -556,8 +554,7 @@ UA_Client_addMethodNode(UA_Client *client, const UA_NodeId requestedNewNodeId,
  * .. _client-subscriptions:
  *
  * Subscriptions Handling
- * ======================
- *
+ * ^^^^^^^^^^^^^^^^^^^^^^
  * At this point, the client does not yet contain its own thread or event-driven
  * main-loop. So the client will not perform any actions automatically in the
  * background. This is especially relevant for subscriptions. The user will have
@@ -607,7 +604,7 @@ UA_Client_Subscriptions_removeMonitoredItem(UA_Client *client,
 
 /**
  * Misc Highlevel Functionality
- * ============================ */
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
 /* Get the namespace-index of a namespace-URI
  *
  * @param client The UA_Client struct for this connection

+ 221 - 118
include/ua_server.h

@@ -1,4 +1,4 @@
- /*
+/*
  * Copyright (C) 2014 the contributors as stated in the AUTHORS file
  *
  * This file is part of open62541. open62541 is free software: you can
@@ -56,19 +56,22 @@ struct UA_ServerNetworkLayer {
      * messages and close events) for dispatch.
      *
      * @param nl The network layer
-     * @param jobs When the returned integer is >0, *jobs points to an array of UA_Job of the
-     *             returned size.
-     * @param timeout The timeout during which an event must arrive in microseconds
-     * @return The size of the jobs array. If the result is negative, an error has occurred. */
+     * @param jobs When the returned integer is >0, *jobs points to an array of
+     *        UA_Job of the returned size.
+     * @param timeout The timeout during which an event must arrive in
+     *        microseconds
+     * @return The size of the jobs array. If the result is negative,
+     *         an error has occurred. */
     size_t (*getJobs)(UA_ServerNetworkLayer *nl, UA_Job **jobs, UA_UInt16 timeout);
 
     /* Closes the network connection and returns all the jobs that need to be
      * finished before the network layer can be safely deleted.
      *
      * @param nl The network layer
-     * @param jobs When the returned integer is >0, jobs points to an array of UA_Job of the
-     *             returned size.
-     * @return The size of the jobs array. If the result is negative, an error has occurred. */
+     * @param jobs When the returned integer is >0, jobs points to an array of
+     *        UA_Job of the returned size.
+     * @return The size of the jobs array. If the result is negative,
+     *         an error has occurred. */
     size_t (*stop)(UA_ServerNetworkLayer *nl, UA_Job **jobs);
 
     /** Deletes the network content. Call only after stopping. */
@@ -143,11 +146,14 @@ void UA_EXPORT UA_Server_delete(UA_Server *server);
  * be triggered.
  *
  * @param server The server object.
- * @param running The loop is run as long as *running is true. Otherwise, the server shuts down.
+ * @param running The loop is run as long as *running is true.
+ *        Otherwise, the server shuts down.
  * @return Returns the statuscode of the UA_Server_run_shutdown method */
-UA_StatusCode UA_EXPORT UA_Server_run(UA_Server *server, volatile UA_Boolean *running);
+UA_StatusCode UA_EXPORT
+UA_Server_run(UA_Server *server, volatile UA_Boolean *running);
 
-/* The prologue part of UA_Server_run (no need to use if you call UA_Server_run) */
+/* The prologue part of UA_Server_run (no need to use if you call
+ * UA_Server_run) */
 UA_StatusCode UA_EXPORT UA_Server_run_startup(UA_Server *server);
 
 /* Executes a single iteration of the server's main loop.
@@ -156,10 +162,13 @@ UA_StatusCode UA_EXPORT UA_Server_run_startup(UA_Server *server);
  * @param waitInternal Should we wait for messages in the networklayer?
  *        Otherwise, the timouts for the networklayers are set to zero.
  *        The default max wait time is 50millisec.
- * @return Returns how long we can wait until the next scheduled job (in millisec) */
-UA_UInt16 UA_EXPORT UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal);
+ * @return Returns how long we can wait until the next scheduled
+ *         job (in millisec) */
+UA_UInt16 UA_EXPORT
+UA_Server_run_iterate(UA_Server *server, UA_Boolean waitInternal);
 
-/* The epilogue part of UA_Server_run (no need to use if you call UA_Server_run) */
+/* The epilogue part of UA_Server_run (no need to use if you call
+ * UA_Server_run) */
 UA_StatusCode UA_EXPORT UA_Server_run_shutdown(UA_Server *server);
 
 /**
@@ -174,17 +183,21 @@ UA_StatusCode UA_EXPORT UA_Server_run_shutdown(UA_Server *server);
  *        occurs at now() + interval at the latest.
  * @param jobId Set to the guid of the repeated job. This can be used to cancel
  *        the job later on. If the pointer is null, the guid is not set.
- * @return Upon success, UA_STATUSCODE_GOOD is returned. An error code otherwise. */
-UA_StatusCode UA_EXPORT UA_Server_addRepeatedJob(UA_Server *server, UA_Job job,
-                                                 UA_UInt32 interval, UA_Guid *jobId);
+ * @return Upon success, UA_STATUSCODE_GOOD is returned.
+ *         An error code otherwise. */
+UA_StatusCode UA_EXPORT
+UA_Server_addRepeatedJob(UA_Server *server, UA_Job job,
+                         UA_UInt32 interval, UA_Guid *jobId);
 
 /* Remove repeated job. The entry will be removed asynchronously during the next
  * iteration of the server main loop.
  *
  * @param server The server object.
  * @param jobId The id of the job that shall be removed.
- * @return Upon sucess, UA_STATUSCODE_GOOD is returned. An error code otherwise. */
-UA_StatusCode UA_EXPORT UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId);
+ * @return Upon sucess, UA_STATUSCODE_GOOD is returned.
+ *         An error code otherwise. */
+UA_StatusCode UA_EXPORT
+UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId);
 
 /* Add a new namespace to the server. Returns the index of the new namespace */
 UA_UInt16 UA_EXPORT UA_Server_addNamespace(UA_Server *server, const char* name);
@@ -200,13 +213,14 @@ UA_UInt16 UA_EXPORT UA_Server_addNamespace(UA_Server *server, const char* name);
  * Reading Node Attributes
  * ~~~~~~~~~~~~~~~~~~~~~~~
  *
- * The following attributes cannot be read, since the local "admin" user always has
- * full rights.
+ * The following attributes cannot be read, since the local "admin" user always
+ * has full rights.
  *
  * - UserWriteMask
  * - UserAccessLevel
  * - UserExecutable */
-/* Don't use this function. There are typed versions for every supported attribute. */
+/* Don't use this function. There are typed versions for every supported
+ * attribute. */
 UA_StatusCode UA_EXPORT
 __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId,
                  UA_AttributeId attributeId, void *v);
@@ -214,101 +228,135 @@ __UA_Server_read(UA_Server *server, const UA_NodeId *nodeId,
 static UA_INLINE UA_StatusCode
 UA_Server_readNodeId(UA_Server *server, const UA_NodeId nodeId,
                      UA_NodeId *outNodeId) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_NODEID, outNodeId); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_NODEID, outNodeId);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readNodeClass(UA_Server *server, const UA_NodeId nodeId,
                         UA_NodeClass *outNodeClass) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_NODECLASS, outNodeClass); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_NODECLASS,
+                            outNodeClass);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readBrowseName(UA_Server *server, const UA_NodeId nodeId,
                          UA_QualifiedName *outBrowseName) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_BROWSENAME, outBrowseName); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_BROWSENAME,
+                            outBrowseName);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readDisplayName(UA_Server *server, const UA_NodeId nodeId,
                           UA_LocalizedText *outDisplayName) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME, outDisplayName); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME,
+                            outDisplayName);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readDescription(UA_Server *server, const UA_NodeId nodeId,
                           UA_LocalizedText *outDescription) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DESCRIPTION, outDescription); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DESCRIPTION,
+                            outDescription);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readWriteMask(UA_Server *server, const UA_NodeId nodeId,
                         UA_UInt32 *outWriteMask) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_WRITEMASK, outWriteMask); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_WRITEMASK,
+                            outWriteMask);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readIsAbstract(UA_Server *server, const UA_NodeId nodeId,
                          UA_Boolean *outIsAbstract) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_ISABSTRACT, outIsAbstract); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_ISABSTRACT,
+                            outIsAbstract);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readSymmetric(UA_Server *server, const UA_NodeId nodeId,
                         UA_Boolean *outSymmetric) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_SYMMETRIC, outSymmetric); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_SYMMETRIC,
+                            outSymmetric);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readInverseName(UA_Server *server, const UA_NodeId nodeId,
                           UA_LocalizedText *outInverseName) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_INVERSENAME, outInverseName); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_INVERSENAME,
+                            outInverseName);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readContainsNoLoop(UA_Server *server, const UA_NodeId nodeId,
                              UA_Boolean *outContainsNoLoops) {
     return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_CONTAINSNOLOOPS,
-                            outContainsNoLoops); }
+                            outContainsNoLoops);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readEventNotifier(UA_Server *server, const UA_NodeId nodeId,
                             UA_Byte *outEventNotifier) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER, outEventNotifier); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER,
+                            outEventNotifier);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readValue(UA_Server *server, const UA_NodeId nodeId,
                     UA_Variant *outValue) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_VALUE, outValue); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_VALUE, outValue);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readDataType(UA_Server *server, const UA_NodeId nodeId,
                        UA_NodeId *outDataType) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DATATYPE, outDataType); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_DATATYPE,
+                            outDataType);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readValueRank(UA_Server *server, const UA_NodeId nodeId,
                         UA_Int32 *outValueRank) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_VALUERANK, outValueRank); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_VALUERANK,
+                            outValueRank);
+}
 
 /* Returns a variant with an int32 array */
 static UA_INLINE UA_StatusCode
 UA_Server_readArrayDimensions(UA_Server *server, const UA_NodeId nodeId,
                               UA_Variant *outArrayDimensions) {
     return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_ARRAYDIMENSIONS,
-                            outArrayDimensions); }
+                            outArrayDimensions);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readAccessLevel(UA_Server *server, const UA_NodeId nodeId,
                           UA_UInt32 *outAccessLevel) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL, outAccessLevel); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL,
+                            outAccessLevel);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readMinimumSamplingInterval(UA_Server *server, const UA_NodeId nodeId,
                                       UA_Double *outMinimumSamplingInterval) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL,
-                            outMinimumSamplingInterval); }
+    return __UA_Server_read(server, &nodeId,
+                            UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL,
+                            outMinimumSamplingInterval);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readHistorizing(UA_Server *server, const UA_NodeId nodeId,
                           UA_Boolean *outHistorizing) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_HISTORIZING, outHistorizing); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_HISTORIZING,
+                            outHistorizing);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_readExecutable(UA_Server *server, const UA_NodeId nodeId,
                          UA_Boolean *outExecutable) {
-    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_EXECUTABLE, outExecutable); }
+    return __UA_Server_read(server, &nodeId, UA_ATTRIBUTEID_EXECUTABLE,
+                            outExecutable);
+}
 
 /**
  * Writing Node Attributes
@@ -336,7 +384,8 @@ UA_Server_readExecutable(UA_Server *server, const UA_NodeId nodeId,
  * - ArrayDimensions
  *
  * Historizing is currently unsupported */
-/* Don't use this function. There are typed versions with no additional overhead. */
+/* Don't use this function. There are typed versions with no additional
+ * overhead. */
 UA_StatusCode UA_EXPORT
 __UA_Server_write(UA_Server *server, const UA_NodeId *nodeId,
                   const UA_AttributeId attributeId,
@@ -346,61 +395,73 @@ static UA_INLINE UA_StatusCode
 UA_Server_writeBrowseName(UA_Server *server, const UA_NodeId nodeId,
                           const UA_QualifiedName browseName) {
     return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_BROWSENAME,
-                             &UA_TYPES[UA_TYPES_QUALIFIEDNAME], &browseName); }
+                             &UA_TYPES[UA_TYPES_QUALIFIEDNAME], &browseName);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_writeDisplayName(UA_Server *server, const UA_NodeId nodeId,
                            const UA_LocalizedText displayName) {
     return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_DISPLAYNAME,
-                             &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &displayName); }
+                             &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &displayName);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_writeDescription(UA_Server *server, const UA_NodeId nodeId,
                            const UA_LocalizedText description) {
     return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_DESCRIPTION,
-                             &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &description); }
+                             &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &description);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_writeWriteMask(UA_Server *server, const UA_NodeId nodeId,
                          const UA_UInt32 writeMask) {
     return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_WRITEMASK,
-                             &UA_TYPES[UA_TYPES_UINT32], &writeMask); }
+                             &UA_TYPES[UA_TYPES_UINT32], &writeMask);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_writeIsAbstract(UA_Server *server, const UA_NodeId nodeId,
                           const UA_Boolean isAbstract) {
     return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_ISABSTRACT,
-                             &UA_TYPES[UA_TYPES_BOOLEAN], &isAbstract); }
+                             &UA_TYPES[UA_TYPES_BOOLEAN], &isAbstract);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_writeInverseName(UA_Server *server, const UA_NodeId nodeId,
                            const UA_LocalizedText inverseName) {
     return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_INVERSENAME,
-                             &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &inverseName); }
+                             &UA_TYPES[UA_TYPES_LOCALIZEDTEXT], &inverseName);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_writeEventNotifier(UA_Server *server, const UA_NodeId nodeId,
                              const UA_Byte eventNotifier) {
     return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_EVENTNOTIFIER,
-                             &UA_TYPES[UA_TYPES_BYTE], &eventNotifier); }
+                             &UA_TYPES[UA_TYPES_BYTE], &eventNotifier);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_writeValue(UA_Server *server, const UA_NodeId nodeId,
                      const UA_Variant value) {
     return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_VALUE,
-                             &UA_TYPES[UA_TYPES_VARIANT], &value); }
+                             &UA_TYPES[UA_TYPES_VARIANT], &value);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_writeAccessLevel(UA_Server *server, const UA_NodeId nodeId,
                            const UA_UInt32 accessLevel) {
     return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_ACCESSLEVEL,
-                             &UA_TYPES[UA_TYPES_UINT32], &accessLevel); }
+                             &UA_TYPES[UA_TYPES_UINT32], &accessLevel);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_writeMinimumSamplingInterval(UA_Server *server, const UA_NodeId nodeId,
                                        const UA_Double miniumSamplingInterval) {
-    return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL,
-                             &UA_TYPES[UA_TYPES_DOUBLE], &miniumSamplingInterval); }
+    return __UA_Server_write(server, &nodeId,
+                             UA_ATTRIBUTEID_MINIMUMSAMPLINGINTERVAL,
+                             &UA_TYPES[UA_TYPES_DOUBLE],
+                             &miniumSamplingInterval);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_writeExecutable(UA_Server *server, const UA_NodeId nodeId,
@@ -412,7 +473,8 @@ UA_Server_writeExecutable(UA_Server *server, const UA_NodeId nodeId,
  * Browsing
  * -------- */
 UA_BrowseResult UA_EXPORT
-UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs, const UA_BrowseDescription *descr);
+UA_Server_browse(UA_Server *server, UA_UInt32 maxrefs,
+                 const UA_BrowseDescription *descr);
 
 UA_BrowseResult UA_EXPORT
 UA_Server_browseNext(UA_Server *server, UA_Boolean releaseContinuationPoint,
@@ -473,10 +535,11 @@ typedef struct {
                      multiple sources */
     /* Copies the data from the source into the provided value.
      *
-     * @param handle An optional pointer to user-defined data for the specific data source
+     * @param handle An optional pointer to user-defined data for the
+     *        specific data source
      * @param nodeid Id of the read node
-     * @param includeSourceTimeStamp If true, then the datasource is expected to set the source
-     *        timestamp in the returned value
+     * @param includeSourceTimeStamp If true, then the datasource is expected to
+     *        set the source timestamp in the returned value
      * @param range If not null, then the datasource shall return only a
      *        selection of the (nonscalar) data. Set
      *        UA_STATUSCODE_BADINDEXRANGEINVALID in the value if this does not
@@ -488,13 +551,14 @@ typedef struct {
      *         original caller are set in the value. If an error is returned,
      *         then no releasing of the value is done. */
     UA_StatusCode (*read)(void *handle, const UA_NodeId nodeid,
-                          UA_Boolean includeSourceTimeStamp, const UA_NumericRange *range,
-                          UA_DataValue *value);
+                          UA_Boolean includeSourceTimeStamp,
+                          const UA_NumericRange *range, UA_DataValue *value);
 
     /* Write into a data source. The write member of UA_DataSource can be empty
      * if the operation is unsupported.
      *
-     * @param handle An optional pointer to user-defined data for the specific data source
+     * @param handle An optional pointer to user-defined data for the
+     *        specific data source
      * @param nodeid Id of the node being written to
      * @param data The data to be written into the data source
      * @param range An optional data range. If the data source is scalar or does
@@ -538,15 +602,17 @@ typedef struct {
 } UA_ObjectLifecycleManagement;
 
 UA_StatusCode UA_EXPORT
-UA_Server_setObjectTypeNode_lifecycleManagement(UA_Server *server, UA_NodeId nodeId,
+UA_Server_setObjectTypeNode_lifecycleManagement(UA_Server *server,
+                                                UA_NodeId nodeId,
                                                 UA_ObjectLifecycleManagement olm);
 
 /**
  * Method Callbacks
  * ~~~~~~~~~~~~~~~~ */
-typedef UA_StatusCode (*UA_MethodCallback)(void *methodHandle, const UA_NodeId objectId,
-                                           size_t inputSize, const UA_Variant *input,
-                                           size_t outputSize, UA_Variant *output);
+typedef UA_StatusCode
+(*UA_MethodCallback)(void *methodHandle, const UA_NodeId objectId,
+                     size_t inputSize, const UA_Variant *input,
+                     size_t outputSize, UA_Variant *output);
 
 #ifdef UA_ENABLE_METHODCALLS
 UA_StatusCode UA_EXPORT
@@ -574,142 +640,179 @@ UA_Server_setMethodNode_callback(UA_Server *server, const UA_NodeId methodNodeId
  * also called for all sub-nodes contained in an object or variable type node
  * that is instantiated. */
 typedef struct {
-  UA_StatusCode (*method)(const UA_NodeId objectId, const UA_NodeId typeDefinitionId, void *handle);
+  UA_StatusCode (*method)(const UA_NodeId objectId,
+                          const UA_NodeId typeDefinitionId, void *handle);
   void *handle;
 } UA_InstantiationCallback;
 
 /* Don't use this function. There are typed versions as inline functions. */
 UA_StatusCode UA_EXPORT
 __UA_Server_addNode(UA_Server *server, const UA_NodeClass nodeClass,
-                    const UA_NodeId requestedNewNodeId, const UA_NodeId parentNodeId,
-                    const UA_NodeId referenceTypeId, const UA_QualifiedName browseName,
-                    const UA_NodeId typeDefinition, const UA_NodeAttributes *attr,
+                    const UA_NodeId requestedNewNodeId,
+                    const UA_NodeId parentNodeId,
+                    const UA_NodeId referenceTypeId,
+                    const UA_QualifiedName browseName,
+                    const UA_NodeId typeDefinition,
+                    const UA_NodeAttributes *attr,
                     const UA_DataType *attributeType,
-                    UA_InstantiationCallback *instantiationCallback, UA_NodeId *outNewNodeId);
+                    UA_InstantiationCallback *instantiationCallback,
+                    UA_NodeId *outNewNodeId);
 
 static UA_INLINE UA_StatusCode
 UA_Server_addVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
-                          const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
-                          const UA_QualifiedName browseName, const UA_NodeId typeDefinition,
+                          const UA_NodeId parentNodeId,
+                          const UA_NodeId referenceTypeId,
+                          const UA_QualifiedName browseName,
+                          const UA_NodeId typeDefinition,
                           const UA_VariableAttributes attr,
                           UA_InstantiationCallback *instantiationCallback,
                           UA_NodeId *outNewNodeId) {
-    return __UA_Server_addNode(server, UA_NODECLASS_VARIABLE, requestedNewNodeId, parentNodeId,
-                               referenceTypeId, browseName, typeDefinition,
-                               (const UA_NodeAttributes*)&attr,
+    return __UA_Server_addNode(server, UA_NODECLASS_VARIABLE, requestedNewNodeId,
+                               parentNodeId, referenceTypeId, browseName,
+                               typeDefinition, (const UA_NodeAttributes*)&attr,
                                &UA_TYPES[UA_TYPES_VARIABLEATTRIBUTES],
-                               instantiationCallback, outNewNodeId); }
+                               instantiationCallback, outNewNodeId);
+}
 
 static UA_INLINE UA_StatusCode
-UA_Server_addVariableTypeNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
-                              const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
+UA_Server_addVariableTypeNode(UA_Server *server,
+                              const UA_NodeId requestedNewNodeId,
+                              const UA_NodeId parentNodeId,
+                              const UA_NodeId referenceTypeId,
                               const UA_QualifiedName browseName,
                               const UA_VariableTypeAttributes attr,
                               UA_InstantiationCallback *instantiationCallback,
                               UA_NodeId *outNewNodeId) {
-    return __UA_Server_addNode(server, UA_NODECLASS_VARIABLETYPE, requestedNewNodeId,
-                               parentNodeId, referenceTypeId, browseName, UA_NODEID_NULL,
+    return __UA_Server_addNode(server, UA_NODECLASS_VARIABLETYPE,
+                               requestedNewNodeId, parentNodeId, referenceTypeId,
+                               browseName, UA_NODEID_NULL,
                                (const UA_NodeAttributes*)&attr,
                                &UA_TYPES[UA_TYPES_VARIABLETYPEATTRIBUTES],
-                               instantiationCallback, outNewNodeId); }
+                               instantiationCallback, outNewNodeId);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_addObjectNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
-                        const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
-                        const UA_QualifiedName browseName, const UA_NodeId typeDefinition,
+                        const UA_NodeId parentNodeId,
+                        const UA_NodeId referenceTypeId,
+                        const UA_QualifiedName browseName,
+                        const UA_NodeId typeDefinition,
                         const UA_ObjectAttributes attr,
                         UA_InstantiationCallback *instantiationCallback,
                         UA_NodeId *outNewNodeId) {
-    return __UA_Server_addNode(server, UA_NODECLASS_OBJECT, requestedNewNodeId, parentNodeId,
-                               referenceTypeId, browseName, typeDefinition,
-                               (const UA_NodeAttributes*)&attr,
+    return __UA_Server_addNode(server, UA_NODECLASS_OBJECT, requestedNewNodeId,
+                               parentNodeId, referenceTypeId, browseName,
+                               typeDefinition, (const UA_NodeAttributes*)&attr,
                                &UA_TYPES[UA_TYPES_OBJECTATTRIBUTES],
-                               instantiationCallback, outNewNodeId); }
+                               instantiationCallback, outNewNodeId);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_addObjectTypeNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
-                            const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
+                            const UA_NodeId parentNodeId,
+                            const UA_NodeId referenceTypeId,
                             const UA_QualifiedName browseName,
                             const UA_ObjectTypeAttributes attr,
                             UA_InstantiationCallback *instantiationCallback,
                             UA_NodeId *outNewNodeId) {
     return __UA_Server_addNode(server, UA_NODECLASS_OBJECTTYPE, requestedNewNodeId,
-                               parentNodeId, referenceTypeId, browseName, UA_NODEID_NULL,
-                               (const UA_NodeAttributes*)&attr,
+                               parentNodeId, referenceTypeId, browseName,
+                               UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
                                &UA_TYPES[UA_TYPES_OBJECTTYPEATTRIBUTES],
-                               instantiationCallback, outNewNodeId); }
+                               instantiationCallback, outNewNodeId);
+}
 
 static UA_INLINE UA_StatusCode
 UA_Server_addViewNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
-                      const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
-                      const UA_QualifiedName browseName, const UA_ViewAttributes attr,
+                      const UA_NodeId parentNodeId,
+                      const UA_NodeId referenceTypeId,
+                      const UA_QualifiedName browseName,
+                      const UA_ViewAttributes attr,
                       UA_InstantiationCallback *instantiationCallback,
                       UA_NodeId *outNewNodeId) {
-    return __UA_Server_addNode(server, UA_NODECLASS_VIEW, requestedNewNodeId, parentNodeId,
-                               referenceTypeId, browseName, UA_NODEID_NULL,
-                               (const UA_NodeAttributes*)&attr,
+    return __UA_Server_addNode(server, UA_NODECLASS_VIEW, requestedNewNodeId,
+                               parentNodeId, referenceTypeId, browseName,
+                               UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
                                &UA_TYPES[UA_TYPES_VIEWATTRIBUTES],
-                               instantiationCallback, outNewNodeId); }
+                               instantiationCallback, outNewNodeId);
+}
 
 static UA_INLINE UA_StatusCode
-UA_Server_addReferenceTypeNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
-                               const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
+UA_Server_addReferenceTypeNode(UA_Server *server,
+                               const UA_NodeId requestedNewNodeId,
+                               const UA_NodeId parentNodeId,
+                               const UA_NodeId referenceTypeId,
                                const UA_QualifiedName browseName,
                                const UA_ReferenceTypeAttributes attr,
                                UA_InstantiationCallback *instantiationCallback,
                                UA_NodeId *outNewNodeId) {
-    return __UA_Server_addNode(server, UA_NODECLASS_REFERENCETYPE, requestedNewNodeId,
-                               parentNodeId, referenceTypeId, browseName, UA_NODEID_NULL,
+    return __UA_Server_addNode(server, UA_NODECLASS_REFERENCETYPE,
+                               requestedNewNodeId, parentNodeId, referenceTypeId,
+                               browseName, UA_NODEID_NULL,
                                (const UA_NodeAttributes*)&attr,
                                &UA_TYPES[UA_TYPES_REFERENCETYPEATTRIBUTES],
-                               instantiationCallback, outNewNodeId); }
+                               instantiationCallback, outNewNodeId);
+}
 
 static UA_INLINE UA_StatusCode
-UA_Server_addDataTypeNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
-                          const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
-                          const UA_QualifiedName browseName, const UA_DataTypeAttributes attr,
+UA_Server_addDataTypeNode(UA_Server *server,
+                          const UA_NodeId requestedNewNodeId,
+                          const UA_NodeId parentNodeId,
+                          const UA_NodeId referenceTypeId,
+                          const UA_QualifiedName browseName,
+                          const UA_DataTypeAttributes attr,
                           UA_InstantiationCallback *instantiationCallback,
                           UA_NodeId *outNewNodeId) {
-    return __UA_Server_addNode(server, UA_NODECLASS_DATATYPE, requestedNewNodeId, parentNodeId,
-                               referenceTypeId, browseName, UA_NODEID_NULL,
-                               (const UA_NodeAttributes*)&attr,
+    return __UA_Server_addNode(server, UA_NODECLASS_DATATYPE, requestedNewNodeId,
+                               parentNodeId, referenceTypeId, browseName,
+                               UA_NODEID_NULL, (const UA_NodeAttributes*)&attr,
                                &UA_TYPES[UA_TYPES_DATATYPEATTRIBUTES],
-                               instantiationCallback, outNewNodeId); }
+                               instantiationCallback, outNewNodeId);
+}
 
 UA_StatusCode UA_EXPORT
-UA_Server_addDataSourceVariableNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
+UA_Server_addDataSourceVariableNode(UA_Server *server,
+                                    const UA_NodeId requestedNewNodeId,
                                     const UA_NodeId parentNodeId,
                                     const UA_NodeId referenceTypeId,
                                     const UA_QualifiedName browseName,
                                     const UA_NodeId typeDefinition,
                                     const UA_VariableAttributes attr,
-                                    const UA_DataSource dataSource, UA_NodeId *outNewNodeId);
+                                    const UA_DataSource dataSource,
+                                    UA_NodeId *outNewNodeId);
 
 #ifdef UA_ENABLE_METHODCALLS
 UA_StatusCode UA_EXPORT
 UA_Server_addMethodNode(UA_Server *server, const UA_NodeId requestedNewNodeId,
-                        const UA_NodeId parentNodeId, const UA_NodeId referenceTypeId,
-                        const UA_QualifiedName browseName, const UA_MethodAttributes attr,
+                        const UA_NodeId parentNodeId,
+                        const UA_NodeId referenceTypeId,
+                        const UA_QualifiedName browseName,
+                        const UA_MethodAttributes attr,
                         UA_MethodCallback method, void *handle,
-                        size_t inputArgumentsSize, const UA_Argument* inputArguments, 
-                        size_t outputArgumentsSize, const UA_Argument* outputArguments,
+                        size_t inputArgumentsSize,
+                        const UA_Argument* inputArguments, 
+                        size_t outputArgumentsSize,
+                        const UA_Argument* outputArguments,
                         UA_NodeId *outNewNodeId);
 #endif
 
 UA_StatusCode UA_EXPORT
-UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId, UA_Boolean deleteReferences);
+UA_Server_deleteNode(UA_Server *server, const UA_NodeId nodeId,
+                     UA_Boolean deleteReferences);
 
 /**
  * Reference Management
  * -------------------- */
 UA_StatusCode UA_EXPORT
-UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId, const UA_NodeId refTypeId,
+UA_Server_addReference(UA_Server *server, const UA_NodeId sourceId,
+                       const UA_NodeId refTypeId,
                        const UA_ExpandedNodeId targetId, UA_Boolean isForward);
 
 UA_StatusCode UA_EXPORT
 UA_Server_deleteReference(UA_Server *server, const UA_NodeId sourceNodeId,
                           const UA_NodeId referenceTypeId, UA_Boolean isForward,
-                          const UA_ExpandedNodeId targetNodeId, UA_Boolean deleteBidirectional);
+                          const UA_ExpandedNodeId targetNodeId,
+                          UA_Boolean deleteBidirectional);
 
 #ifdef __cplusplus
 }

+ 86 - 57
include/ua_types.h

@@ -39,12 +39,14 @@ extern "C" {
  *   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.
+ *   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``.
  * ``void T_deleteMembers(T *ptr)``
- *   Delete the dynamically allocated content of the data type, but not the data type itself.
+ *   Delete the dynamically allocated content of the data type, but not the data
+ *   type itself.
  * ``void T_delete(T *ptr)``
  *   Delete the content of the data type and the memory for the data type itself.
  *
@@ -115,7 +117,8 @@ typedef uint32_t UA_UInt32;
 /**
  * Int64
  * ^^^^^
- * An integer value between -10 223 372 036 854 775 808 and 9 223 372 036 854 775 807. */
+ * An integer value between -10 223 372 036 854 775 808 and
+ * 9 223 372 036 854 775 807. */
 typedef int64_t UA_Int64;
 #define UA_INT64_MAX (int64_t)9223372036854775807
 #define UA_INT64_MIN ((int64_t)-9223372036854775808)
@@ -145,8 +148,9 @@ typedef double UA_Double;
  *
  * StatusCode
  * ^^^^^^^^^^
- * 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. */
+ * 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;
 
 /**
@@ -183,7 +187,9 @@ void UA_EXPORT * UA_Array_new(size_t size, const UA_DataType *type) UA_FUNC_ATTR
  * @param dst The location of the pointer to the new array
  * @param type The datatype of the array members
  * @return Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY */
-UA_StatusCode UA_EXPORT UA_Array_copy(const void *src, size_t size, void **dst, const UA_DataType *type) UA_FUNC_ATTR_WARN_UNUSED_RESULT;
+UA_StatusCode UA_EXPORT
+UA_Array_copy(const void *src, size_t size, void **dst,
+              const UA_DataType *type) UA_FUNC_ATTR_WARN_UNUSED_RESULT;
 
 /* Deletes an array.
  *
@@ -242,7 +248,8 @@ typedef int64_t UA_DateTime;
 /* The current time */
 UA_DateTime UA_EXPORT UA_DateTime_now(void);
 
-/* CPU clock invariant to system time changes. Use only for time diffs, not current time */
+/* CPU clock invariant to system time changes. Use only for time diffs, not
+ * current time */
 UA_DateTime UA_EXPORT UA_DateTime_nowMonotonic(void);
 
 typedef struct UA_DateTimeStruct {
@@ -284,10 +291,13 @@ typedef UA_String UA_ByteString;
 
 static UA_INLINE UA_Boolean
 UA_ByteString_equal(const UA_ByteString *string1, const UA_ByteString *string2) {
-    return UA_String_equal((const UA_String*)string1, (const UA_String*)string2); }
+    return UA_String_equal((const UA_String*)string1, (const UA_String*)string2);
+}
 
-/* Allocates memory of size length for the bytestring. The content is not set to zero. */
-UA_StatusCode UA_EXPORT UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length);
+/* Allocates memory of size length for the bytestring.
+ * The content is not set to zero. */
+UA_StatusCode UA_EXPORT
+UA_ByteString_allocBuffer(UA_ByteString *bs, size_t length);
 
 UA_EXPORT extern const UA_ByteString UA_BYTESTRING_NULL;
 
@@ -314,8 +324,9 @@ 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 also become 1 or 2
-                                     (2byte and 4byte encoding of small numeric 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
@@ -489,8 +500,9 @@ typedef struct {
         UA_EXTENSIONOBJECT_ENCODED_BYTESTRING = 1,
         UA_EXTENSIONOBJECT_ENCODED_XML        = 2,
         UA_EXTENSIONOBJECT_DECODED            = 3,
-        UA_EXTENSIONOBJECT_DECODED_NODELETE   = 4 /* Don't delete the decoded content
-                                                     at the lifecycle end */
+        UA_EXTENSIONOBJECT_DECODED_NODELETE   = 4 /* Don't delete the content
+                                                     together with the
+                                                     ExtensionObject */
     } encoding;
     union {
         struct {
@@ -532,18 +544,20 @@ typedef struct {
 typedef struct {
     const UA_DataType *type; /* The data type description */
     enum {
-        UA_VARIANT_DATA,          /* The data has the same lifecycle as the variant */
-        UA_VARIANT_DATA_NODELETE, /* The data is "borrowed" by the variant and shall not be
-                                     deleted at the end of the variant's lifecycle. */
+        UA_VARIANT_DATA,          /* The data has the same lifecycle as the
+                                     variant */
+        UA_VARIANT_DATA_NODELETE, /* The data is "borrowed" by the variant and
+                                     shall not be deleted at the end of the
+                                     variant's lifecycle. */
     } storageType;
-    size_t arrayLength;  // The number of elements in the data array
-    void *data; // Points to the scalar or array data
-    size_t arrayDimensionsSize; // The number of dimensions the data-array has
-    UA_Int32 *arrayDimensions; // The length of each dimension of the data-array
+    size_t arrayLength;         /* The number of elements in the data array */
+    void *data;                 /* Points to the scalar or array data */
+    size_t arrayDimensionsSize; /* The number of dimensions the data-array has */
+    UA_Int32 *arrayDimensions;  /* The length of each dimension */
 } UA_Variant;
 
-/* Returns true if the variant contains a scalar value. Note that empty variants contain
- * an array of length -1 (undefined).
+/* Returns true if the variant contains a scalar value. Note that empty variants
+ * contain an array of length -1 (undefined).
  *
  * @param v The variant
  * @return Does the variant contain a scalar value. */
@@ -552,23 +566,27 @@ 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.
+/* 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.
  *
  * @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.
+/* 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.
  *
  * @param v The variant
  * @param array A pointer to the array data
@@ -603,16 +621,17 @@ typedef struct {
     } *dimensions;
 } UA_NumericRange;
 
-/* Copy the variant, but use only a subset of the (multidimensional) array into a variant.
- * Returns an error code if the variant is not an array or if the indicated range does not
- * fit.
+/* Copy the variant, but use only a subset of the (multidimensional) array into
+ * a variant. Returns an error code if the variant is not an array or if the
+ * indicated range does not fit.
  *
  * @param src The source variant
  * @param dst The target variant
  * @param range The range of the copied data
  * @return Returns UA_STATUSCODE_GOOD or an error code */
 UA_StatusCode UA_EXPORT
-UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst, const UA_NumericRange range);
+UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst,
+                     const UA_NumericRange range);
 
 /* Insert a range of data into an existing variant. The data array can't be
  * reused afterwards if it contains types without a fixed size (e.g. strings)
@@ -620,7 +639,8 @@ UA_Variant_copyRange(const UA_Variant *src, UA_Variant *dst, const UA_NumericRan
  *
  * @param v The variant
  * @param dataArray The data array. The type must match the variant
- * @param dataArraySize The length of the data array. This is checked to match the range size.
+ * @param dataArraySize The length of the data array. This is checked to match
+ *        the range size.
  * @param range The range of where the new data is inserted
  * @return Returns UA_STATUSCODE_GOOD or an error code */
 UA_StatusCode UA_EXPORT
@@ -631,7 +651,8 @@ UA_Variant_setRange(UA_Variant *v, void * UA_RESTRICT array,
  *
  * @param v The variant
  * @param dataArray The data array. The type must match the variant
- * @param dataArraySize The length of the data array. This is checked to match the range size.
+ * @param dataArraySize The length of the data array. This is checked to match
+ *        the range size.
  * @param range The range of where the new data is inserted
  * @return Returns UA_STATUSCODE_GOOD or an error code */
 UA_StatusCode UA_EXPORT
@@ -690,14 +711,17 @@ typedef struct {
 #ifdef UA_ENABLE_TYPENAMES
     const char *memberName;
 #endif
-    UA_UInt16 memberTypeIndex;    /* Index of the member in the array of data types */
-    UA_Byte   padding;            /* How much padding is there before this member element?
-                                     For arrays this is the padding before the size_t
-                                     lenght member. (No padding between size_t and the
+    UA_UInt16 memberTypeIndex;    /* Index of the member in the array of data
+                                     types */
+    UA_Byte   padding;            /* How much padding is there before this
+                                     member element? For arrays this is the
+                                     padding before the size_t lenght member.
+                                     (No padding between size_t and the
                                      following ptr.) */
-    UA_Boolean namespaceZero : 1; /* The type of the member is defined in namespace zero.
-                                     In this implementation, types from custom namespace
-                                     may contain members from the same namespace or ns0
+    UA_Boolean namespaceZero : 1; /* The type of the member is defined in
+                                     namespace zero. In this implementation,
+                                     types from custom namespace may contain
+                                     members from the same namespace or ns0
                                      only.*/
     UA_Boolean isArray       : 1; /* The member is an array */
 } UA_DataTypeMember;
@@ -710,9 +734,10 @@ struct UA_DataType {
     UA_UInt16  memSize;          /* Size of the struct in memory */
     UA_UInt16  typeIndex;        /* Index of the type in the datatypetable */
     UA_Byte    membersSize;      /* How many members does the type have? */
-    UA_Boolean builtin      : 1; /* The type is "builtin" and has dedicated de- and
-                                    encoding functions */
-    UA_Boolean fixedSize    : 1; /* The type (and its members) contains no pointers */
+    UA_Boolean builtin      : 1; /* The type is "builtin" and has dedicated de-
+                                    and encoding functions */
+    UA_Boolean fixedSize    : 1; /* The type (and its members) contains no
+                                    pointers */
     UA_Boolean overlayable  : 1; /* The type has the identical memory layout in
                                     memory and on the binary stream. */
     UA_DataTypeMember *members;
@@ -723,7 +748,8 @@ struct UA_DataType {
 /* Allocates and initializes a variable of type dataType
  *
  * @param type The datatype description
- * @return Returns the memory location of the variable or (void*)0 if no memory is available */
+ * @return Returns the memory location of the variable or (void*)0 if no
+ *         memory is available */
 void UA_EXPORT * UA_new(const UA_DataType *type) UA_FUNC_ATTR_MALLOC;
 
 /* Initializes a variable to default values
@@ -735,19 +761,21 @@ 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.
+/* 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.
  *
  * @param src The memory location of the source variable
  * @param dst The memory location of the destination variable
  * @param type The datatype description
  * @return Indicates whether the operation succeeded or returns an error code */
-UA_StatusCode UA_EXPORT UA_copy(const void *src, void *dst, const UA_DataType *type);
+UA_StatusCode UA_EXPORT
+UA_copy(const void *src, void *dst, const UA_DataType *type);
 
-/* Deletes the dynamically allocated content of a variable (e.g. resets all arrays to
- * undefined arrays). Afterwards, the variable can be safely deleted without causing
- * memory leaks. But the variable is not initialized and may contain old data that is not
- * memory-relevant.
+/* Deletes the dynamically allocated content of a variable (e.g. resets all
+ * arrays to undefined arrays). Afterwards, the variable can be safely deleted
+ * without causing memory leaks. But the variable is not initialized and may
+ * contain old data that is not memory-relevant.
  *
  * @param p The memory location of the variable
  * @param type The datatype description of the variable */
@@ -762,11 +790,12 @@ void UA_EXPORT UA_delete(void *p, const UA_DataType *type);
 /**
  * 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. */
+ * 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. */
 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 */
+UA_UInt32 UA_EXPORT UA_UInt32_random(void); /* no cryptographic entropy */
+UA_Guid UA_EXPORT UA_Guid_random(void);     /* no cryptographic entropy */
 
 #ifdef __cplusplus
 } // extern "C"