Check-in [0ba65209b1]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:update open62541 amalgamation to version 1.0
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0ba65209b144c1d483f26e5e19ed6959adb9efac
User & Date: chw 2019-10-11 19:17:19
Context
2019-10-11
19:18
more tk upstream changes check-in: c9c48cbf65 user: chw tags: trunk
19:17
update open62541 amalgamation to version 1.0 check-in: 0ba65209b1 user: chw tags: trunk
16:14
update awthemes to version 3.1 check-in: d1febd9750 user: chw tags: trunk
Changes

Changes to jni/topcua/open62541/AUTHORS.

3
4
5
6
7
8
9
10
11
12
13
Bauer, Maximilian
Ebrahimi, Reza <reza.ebrahimi.dev (at) gmail.com>
Graube, Markus <markus.graube (at) tu-dresden.de>
Gruener, Sten <s.gruener (at) plt.rwth-aachen.de>
Iatrou, Chris Paul <chris_paul.iatrou (at) tu-dresden.de>
Jeromin, Holger
Palm, Florian <f.palm (at) plt.rwth-aachen.de>
Pfrommer, Julius <julius.pfrommer (at) kit.edu>
Profanter, Stefan <profanter (at) fortiss.org>
Stalder, Thomas <t.stalder (at) bluetimeconcept.ch>
Urbas, Leon <leon.urbas (at) tu-dresden.de>







|



3
4
5
6
7
8
9
10
11
12
13
Bauer, Maximilian
Ebrahimi, Reza <reza.ebrahimi.dev (at) gmail.com>
Graube, Markus <markus.graube (at) tu-dresden.de>
Gruener, Sten <s.gruener (at) plt.rwth-aachen.de>
Iatrou, Chris Paul <chris_paul.iatrou (at) tu-dresden.de>
Jeromin, Holger
Palm, Florian <f.palm (at) plt.rwth-aachen.de>
Pfrommer, Julius <julius.pfrommer (at) iosb.fraunhofer.edu>
Profanter, Stefan <profanter (at) fortiss.org>
Stalder, Thomas <t.stalder (at) bluetimeconcept.ch>
Urbas, Leon <leon.urbas (at) tu-dresden.de>

Changes to jni/topcua/open62541/README.md.

1
2
3
4
5
6

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46










47
48
49
50
51
52
53
54






55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88













89

90
91
92
93


































94
95
96





97
98
99


100
101
102
103
104
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
...
127
128
129
130
131
132
133

134
135
136
137
138
139
140
141
142
143

144
145
146
147
148

149
150
151
152
153
154
155
open62541
=========

open62541 (http://open62541.org) is an open source and free implementation of OPC UA (OPC Unified Architecture) written in the common subset of the C99 and C++98 languages. The library is usable with all major compilers and provides the necessary tools to implement dedicated OPC UA clients and servers, or to integrate OPC UA-based communication into existing applications. open62541 library is platform independent. All platform-specific functionality is implemented via exchangeable plugins. Plugin implementations are provided for the major operating systems.

open62541 is licensed under the Mozilla Public License v2.0. So the *open62541 library can be used in projects that are not open source*. Only changes to the open62541 library itself need to published under the same license. The plugins, as well as the server and client examples are in the public domain (CC0 license). They can be reused under any license and changes do not have to be published.


The library is [available](https://github.com/open62541/open62541/releases) in standard source and binary form. In addition, the single-file source distribution merges the entire library into a single .c and .h file that can be easily added to existing projects. Example server and client implementations can be found in the [/examples](examples/) directory or further down on this page.

[![Ohloh Project Status](https://www.ohloh.net/p/open62541/widgets/project_thin_badge.gif)](https://www.ohloh.net/p/open62541)
[![Build Status](https://img.shields.io/travis/open62541/open62541/master.svg)](https://travis-ci.org/open62541/open62541)
[![MSVS build status](https://img.shields.io/appveyor/ci/open62541/open62541/master.svg)](https://ci.appveyor.com/project/open62541/open62541/branch/master)
[![Coverity Scan Build Status](https://img.shields.io/coverity/scan/12248.svg)](https://scan.coverity.com/projects/open62541-open62541)
[![Coverage Status](https://img.shields.io/coveralls/open62541/open62541/master.svg)](https://coveralls.io/r/open62541/open62541?branch=master)
[![Overall Downloads](https://img.shields.io/github/downloads/open62541/open62541/total.svg)](https://github.com/open62541/open62541/releases)

### Features

For a complete list of features check: [open62541 Features](FEATURES.md)

open62541 implements the OPC UA binary protocol stack as well as a client and server SDK. It currently supports the Micro Embedded Device Server Profile plus some additional features. The final server binaries can be well under 100kb, depending on the size of the information model.
- Communication Stack
  - OPC UA binary protocol
  - Chunking (splitting of large messages)
  - Exchangeable network layer (plugin) for using custom networking APIs (e.g. on embedded targets)
- Information model
  - Support for all OPC UA node types (including method nodes)
  - Support for adding and removing nodes and references also at runtime.
  - Support for inheritance and instantiation of object- and variable-types (custom constructor/destructor, instantiation of child nodes)
- Subscriptions
  - Support for subscriptions/monitoreditems for data change notifications
  - Very low resource consumption for each monitored value (event-based server architecture)
- Code-Generation
  - Support for generating data types from standard XML definitions
  - Support for generating server-side information models (nodesets) from standard XML definitions
  
Features currently being implemented:
- Target 0.3 release (to be released in the coming weeks):
  - Secure communication with encrypted messages (Done)
  - Access control for individual nodes (Done)
  - Asynchronous service requests in the client (Done)
- Target 0.4 release:
  - Events (notifications emitted by objects, data change notifications are implemented), WIP by @Pro
  - Event-loop (background tasks) in the client
  - Publish/Subscribe based on UDP (Specification Part 14), WIP @ Fraunhofer IOSB











### Dependencies

On most systems, open62541 requires the C standard library only. For dependencies during the build process, see the following list and the [build documentation](https://open62541.org/doc/current/building.html) for details.

- Core Library: The core library has no dependencies besides the C99 standard headers.
- Default Plugins: The default plugins use the POSIX interfaces for networking and accessing the system clock. Ports to different (embedded) architectures are achieved by customizing the plugins.
- Building and Code Generation: The build environment is generated via CMake. Some code is auto-generated from XML definitions that are part of the OPC UA standard. The code generation scripts run with both Python 2 and 3.







### Code Quality

We emphasize code quality. The following quality metrics are continuously checked and are ensured to hold before an official release is made:

- Zero errors indicated by the Compliance Testing Tool (CTT) of the OPC Foundation for the supported features
- Zero compiler warnings from GCC/Clang/MSVC with very strict compilation flags
- Zero issues indicated by unit tests (more than 80% coverage)
- Zero issues indicated by clang-analyzer, clang-tidy, cpp-check and the Coverity static code analysis tools
- Zero unresolved issues from fuzzing the library in Google's oss-fuzz infrastructure
- Zero issues indicated by Valgrind (Linux), DrMemory (Windows) and Clang AddressSanitizer / MemorySanitizer for the CTT tests, unit tests and fuzzing

### Documentation and Support

A general introduction to OPC UA and the open62541 documentation can be found at http://open62541.org/doc/current.
Past releases of the library can be downloaded at https://github.com/open62541/open62541/releases.
To use the latest improvements, download a nightly build of the *single-file distribution* (the entire library merged into a single source and header file) from http://open62541.org/releases. Nightly builds of MSVC binaries of the library are available [here](https://ci.appveyor.com/project/open62541/open62541/build/artifacts).

For individual discussion and support, use the following channels

- the [mailing list](https://groups.google.com/d/forum/open62541)
- our [IRC channel](http://webchat.freenode.net/?channels=%23open62541)
- the [bugtracker](https://github.com/open62541/open62541/issues)

or contact a member of the core development group (see below).

### Development

Besides the general open62541 community, a group of core maintainers jointly steers the long-term development. The current core maintainers are (as of Mai 2017, in alphabetical order):

- Chris-Paul Iatrou (Dresden University of Technology, Chair for Process Control Systems Engineering)
- Florian Palm (RWTH Aachen University, Chair of Process Control Engineering)
- Julius Pfrommer (Fraunhofer IOSB, Karlsruhe)
- Stefan Profanter (fortiss, Munich)














As an open source project, we encourage new contributors to help improve open62541. The following are good starting points for new contributors:

- [Report bugs](https://github.com/open62541/open62541/issues)
- Improve the [documentation](http://open62541.org/doc/current)
- Work on issues marked as "[good first issue](https://github.com/open62541/open62541/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)"



































### Example Server Implementation
Compile the examples with the single-file distribution `open62541.h/.c` header and source file.
Using the GCC compiler, just run ```gcc -std=c99 <server.c> open62541.c -o server``` (under Windows you may need to add ``` -lws2_32```).





```c
#include <signal.h>
#include "open62541.h"



UA_Boolean running = true;
void signalHandler(int sig) {
    running = false;
}

int main(int argc, char** argv)
{
    signal(SIGINT, signalHandler); /* catch ctrl-c */

    /* Create a server listening on port 4840 */
    UA_ServerConfig *config = UA_ServerConfig_new_default();
    UA_Server *server = UA_Server_new(config);


    /* Add a variable node */
    /* 1) Define the node attributes */
    UA_VariableAttributes attr = UA_VariableAttributes_default;
    attr.displayName = UA_LOCALIZEDTEXT("en-US", "the answer");
    UA_Int32 myInteger = 42;
    UA_Variant_setScalar(&attr.value, &myInteger, &UA_TYPES[UA_TYPES_INT32]);
................................................................................

    /* 3) Add the node */
    UA_Server_addVariableNode(server, newNodeId, parentNodeId, parentReferenceNodeId,
                              browseName, variableType, attr, NULL, NULL);

    /* Run the server loop */
    UA_StatusCode status = UA_Server_run(server, &running);

    UA_Server_delete(server);
    UA_ServerConfig_delete(config);
    return status;
}
```

### Example Client Implementation
```c
#include <stdio.h>
#include "open62541.h"


int main(int argc, char *argv[])
{
    /* Create a client and connect */
    UA_Client *client = UA_Client_new(UA_ClientConfig_default);

    UA_StatusCode status = UA_Client_connect(client, "opc.tcp://localhost:4840");
    if(status != UA_STATUSCODE_GOOD) {
        UA_Client_delete(client);
        return status;
    }

    /* Read the value attribute of the node. UA_Client_readValueAttribute is a
|
<

|

<
>



|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>








>
>
>
>
>
>







|









|





|

|
<
<






>
>
>
>
>
>
>
>
>
>
>
>
>
|
>




>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

<
<
>
>
>
>
>


<
>
>











<
|
>







 







>

<







|
>




|
>







1

2
3
4

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95


96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155


156
157
158
159
160
161
162

163
164
165
166
167
168
169
170
171
172
173
174
175

176
177
178
179
180
181
182
183
184
...
192
193
194
195
196
197
198
199
200

201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# open62541


open62541 (<http://open62541.org>) is an open source and free implementation of OPC UA (OPC Unified Architecture) written in the common subset of the C99 and C++98 languages. The library is usable with all major compilers and provides the necessary tools to implement dedicated OPC UA clients and servers, or to integrate OPC UA-based communication into existing applications. open62541 library is platform independent. All platform-specific functionality is implemented via exchangeable plugins. Plugin implementations are provided for the major operating systems.


open62541 is licensed under the Mozilla Public License v2.0 (MPLv2). This allows the open62541 library to be combined and distributed with any proprietary software. Only changes to the open62541 library itself need to be licensed under the MPLv2 when copied and distributed. The plugins, as well as the server and client examples are in the public domain (CC0 license). They can be reused under any license and changes do not have to be published.

The library is [available](https://github.com/open62541/open62541/releases) in standard source and binary form. In addition, the single-file source distribution merges the entire library into a single .c and .h file that can be easily added to existing projects. Example server and client implementations can be found in the [/examples](examples/) directory or further down on this page.

### Features and Certification

open62541 implements the OPC UA binary protocol stack as well as a client and server SDK. The final server binaries can be well under 100kb, depending on the selected features and the size of the information model.

- Communication Stack
  - OPC UA binary protocol
  - OPC UA JSON encoding
  - Secure communication with encrypted messages
  - Exchangeable network layer (plugin) for using custom networking APIs (e.g. on embedded targets)
  - Support for generating data types from standard XML definitions
- Server
  - Support for all OPC UA node types
  - Access control for individual nodes
  - Support for generating server-side information models from standard XML definitions (nodesets)
  - Support for adding and removing nodes and references also at runtime.
  - Support for inheritance and instantiation of object- and variable-types (custom constructor/destructor, instantiation of child nodes)
  - Support for subscriptions/monitoreditems (data change notifications and events)
- Client
  - All OPC UA services supported
  - Asynchronous service requests
  - Background handling of subscriptions
- Publish/Subscribe
  - UADP Binary protocol with UDP-multicast or Ethernet communication
  - PubSub JSON encoding

### Official Certification

The sample server (server_ctt) built using open62541 v1.0 is in conformance with the 'Micro Embedded Device Server' Profile of OPC Foundation supporting OPC UA client/server communication, subscriptions, method calls and security (encryption) with the security policies 'Basic128Rsa15', 'Basic256' and 'Basic256Sha256' and the facets 'method server' and 'node management'. See https://open62541.org/certified-sdk for more details.

PubSub (UADP) is implemented in open62541. But the feature cannot be certified at this point in time (Sep-2019) due to the lack of official test cases and testing tools.

During development, the Conformance Testing Tools (CTT) of the OPC Foundation are regularly applied.
The CTT configuration and results are tracked at https://github.com/open62541/open62541-ctt. The OPC UA profiles under regular test in the CTT are currently:

- Micro Embedded Device Server
- Method Server Facet
- Node Management Facet
- Security Policies
  - Basic128Rsa15
  - Basic256
  - Basic256Sha256
- User Tokens
  - Anonymous Facet
  - User Name Password Server Facet

See the page on [open62541 Features](FEATURES.md) for an in-depth look at the support for the conformance units that make up the OPC UA profiles.
  
### Dependencies

On most systems, open62541 requires the C standard library only. For dependencies during the build process, see the following list and the [build documentation](https://open62541.org/doc/current/building.html) for details.

- Core Library: The core library has no dependencies besides the C99 standard headers.
- Default Plugins: The default plugins use the POSIX interfaces for networking and accessing the system clock. Ports to different (embedded) architectures are achieved by customizing the plugins.
- Building and Code Generation: The build environment is generated via CMake. Some code is auto-generated from XML definitions that are part of the OPC UA standard. The code generation scripts run with both Python 2 and 3.

**Note:**
Specific optional features are dependent on third-party libraries. These are all listed under the `deps/` folder.
Depending on the selected feature set, some of these libraries will be included in the resulting library.

More information on the third-party libraries can be found in the corresponding [deps/README.md](deps/README.md)

### Code Quality

We emphasize code quality. The following quality metrics are continuously checked and are ensured to hold before an official release is made:

- Zero errors indicated by the Compliance Testing Tool (CTT) of the OPC Foundation for the supported features
- Zero compiler warnings from GCC/Clang/MSVC with very strict compilation flags
- Zero issues indicated by unit tests (more than 80% coverage)
- Zero issues indicated by clang-analyzer, clang-tidy, cpp-check and the Codacy static code analysis tools
- Zero unresolved issues from fuzzing the library in Google's oss-fuzz infrastructure
- Zero issues indicated by Valgrind (Linux), DrMemory (Windows) and Clang AddressSanitizer / MemorySanitizer for the CTT tests, unit tests and fuzzing

### Documentation and Support

A general introduction to OPC UA and the open62541 documentation can be found at http://open62541.org/doc/current.
Past releases of the library can be downloaded at https://github.com/open62541/open62541/releases.
To use the latest improvements, download a nightly build of the *single-file distribution* (the entire library merged into a single source and header file) from http://open62541.org/releases. Nightly builds of MSVC binaries of the library are available [here](https://ci.appveyor.com/project/open62541/open62541/build/artifacts).

For individual discussion and support, use the following channels:

- the [mailing list](https://groups.google.com/d/forum/open62541)
- our [IRC channel](http://webchat.freenode.net/?channels=%23open62541)
- the [bugtracker](https://github.com/open62541/open62541/issues)

We want to foster an open and welcoming community. Please take our [code of conduct](CODE_OF_CONDUCT.md) into regard.

Jointly with the overall open62541 community, the core maintainers steer the long-term development. The current core maintainers are (as of April 2018, in alphabetical order):



- Chris-Paul Iatrou (Dresden University of Technology, Chair for Process Control Systems Engineering)
- Florian Palm (RWTH Aachen University, Chair of Process Control Engineering)
- Julius Pfrommer (Fraunhofer IOSB, Karlsruhe)
- Stefan Profanter (fortiss, Munich)

## Support & Development

### Commercial Support

The open62541 community handles support requests for the open source library and its development. Custom development and individual support is provided by commercial partners that are affiliated with open62541:

- [Kalycito Infotech, Tamil Nadu, INDIA](https://www.kalycito.com/landing/open62541-commercial-partner) for embedded and realtime IIoT applications (Contact: enterprise.services@kalycito.com)
- [basysKom GmbH, Darmstadt, Germany](https://www.basyskom.com/) Software Engineering for Embedded Systems. (Contact: info@basysKom.com) 

For custom development that shall eventually become part of the open62541 library, please keep one of the core maintainers in the loop. Again, please note that all changes to files that are already licensed under the MPLv2 automatically become MPLv2 as well. Static linking of the open62541 library with code under a different license is possible. All architecture-specific code is implemented in the form of exchangeable plugins under a very permissible CC0 license.

### Development

As an open source project, new contributors are encouraged to help improve open62541. The following are good starting points for new contributors:

- [Report bugs](https://github.com/open62541/open62541/issues)
- Improve the [documentation](http://open62541.org/doc/current)
- Work on issues marked as "[good first issue](https://github.com/open62541/open62541/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)"

### Success Stories and Users of open62541

A list of projects and companies using our open62541 stack can be found in our Wiki:

https://github.com/open62541/open62541/wiki/References-to-open62541

## Installation and code usage

For every release, we provide some pre-packed release packages which you can directly use in your compile infrastructure.

Have a look at the [release page](https://github.com/open62541/open62541/releases) and the corresponding attached assets.

A more detailed explanation on how to install the open62541 SDK is given in our [documentation](https://open62541.org/doc/current/installing.html).

You can not directly download a .zip package from the main branches using the Github UI, since then some of the submodules and version strings are missing.
Therefore you have three options to install and use this stack:

- **Recommended:** Use any of the prepared packages attached to every release or in the package repository of your distro (if available).  
  Please check the install guide for more info.
  
- Download a .zip package of special `pack/` branches.  
  These pack branches are up-to-date with the corresponding base branches, but already have the submodules in-place and the version string set correctly.  
  Here are some direct download links for the current pack branches:  
  - [pack/master.zip](https://github.com/open62541/open62541/archive/pack/master.zip)
  - [pack/1.0.zip](https://github.com/open62541/open62541/archive/pack/1.0.zip)
   
- Clone this repository and initialize all the submodules using `git submodule update --init --recursive`. Then either use `make install` or setup your CMake project correspondingly.

## Examples

A complete list of examples can be found in the [examples directory](https://github.com/open62541/open62541/tree/master/examples).

To build the examples, we recommend to install the open62541 project as mentioned in previous section.

### Example Server Implementation



The following simple server example can be built using gcc, after you installed open62541 on your system.

Using the GCC compiler, just run ```gcc -std=c99 -lopen62541 -DUA_ARCHITECTURE_POSIX <server.c> -o server``` (under Windows you may need to add ``` -lws2_32``` 
and change `-DUA_ARCHITECTURE_POSIX` to `-DUA_ARCHITECTURE_WIN32`).
```c
#include <signal.h>

#include <open62541/server.h>
#include <open62541/server_config_default.h>

UA_Boolean running = true;
void signalHandler(int sig) {
    running = false;
}

int main(int argc, char** argv)
{
    signal(SIGINT, signalHandler); /* catch ctrl-c */

    /* Create a server listening on port 4840 */

    UA_Server *server = UA_Server_new();
    UA_ServerConfig_setDefault(UA_Server_getConfig(server));

    /* Add a variable node */
    /* 1) Define the node attributes */
    UA_VariableAttributes attr = UA_VariableAttributes_default;
    attr.displayName = UA_LOCALIZEDTEXT("en-US", "the answer");
    UA_Int32 myInteger = 42;
    UA_Variant_setScalar(&attr.value, &myInteger, &UA_TYPES[UA_TYPES_INT32]);
................................................................................

    /* 3) Add the node */
    UA_Server_addVariableNode(server, newNodeId, parentNodeId, parentReferenceNodeId,
                              browseName, variableType, attr, NULL, NULL);

    /* Run the server loop */
    UA_StatusCode status = UA_Server_run(server, &running);

    UA_Server_delete(server);

    return status;
}
```

### Example Client Implementation
```c
#include <stdio.h>
#include <open62541/client.h>
#include <open62541/client_config_default.h>

int main(int argc, char *argv[])
{
    /* Create a client and connect */
    UA_Client *client = UA_Client_new();
    UA_ClientConfig_setDefault(UA_Client_getConfig(client));
    UA_StatusCode status = UA_Client_connect(client, "opc.tcp://localhost:4840");
    if(status != UA_STATUSCODE_GOOD) {
        UA_Client_delete(client);
        return status;
    }

    /* Read the value attribute of the node. UA_Client_readValueAttribute is a

Changes to jni/topcua/open62541/chw.patch.

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
38
39
40
41
42
43
44
45
46
47
























48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107









108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148

149
150
151
152
The following patch relaxes type checking on attribute R/W functions.
This simplifies the "opcua read ..." and "opcua write ..." logic.
Another change allows the server's logger to be fully overriden.
It changes the default timeout to 10 milliseconds and adds some
functions to get/set the custom data type array on client and server.

--- open62541.c.orig	2019-07-23 10:51:53.000000000 +0200
+++ open62541.c	2019-07-29 16:06:35.645995289 +0200
@@ -27145,7 +27145,7 @@
 #include <valgrind/memcheck.h>
 #endif

 
-#define UA_MAXTIMEOUT 50 /* Max timeout in ms between main-loop iterations */
+#define UA_MAXTIMEOUT 10 /* Max timeout in ms between main-loop iterations */
 
 /**
  * Worker Threads and Dispatch Queue
@@ -37513,7 +37513,7 @@
     UA_WriteValue_init(&wValue);
     wValue.nodeId = *nodeId;
     wValue.attributeId = attributeId;
-    if(attributeId == UA_ATTRIBUTEID_VALUE)
+    if(attributeId == UA_ATTRIBUTEID_VALUE && inDataType == &UA_TYPES[UA_TYPES_VARIANT])
         wValue.value.value = *(const UA_Variant*)in;
     else
         /* hack. is never written into. */
@@ -37616,13 +37616,16 @@
     if(attributeId == UA_ATTRIBUTEID_VALUE) {
         memcpy(out, &res->value, sizeof(UA_Variant));
         UA_Variant_init(&res->value);
-    } else if(attributeId == UA_ATTRIBUTEID_NODECLASS) {
+    } else if(attributeId == UA_ATTRIBUTEID_NODECLASS && outDataType != &UA_TYPES[UA_TYPES_VARIANT]) {
         memcpy(out, (UA_NodeClass*)res->value.data, sizeof(UA_NodeClass));
     } else if(UA_Variant_isScalar(&res->value) &&
................................................................................
         res->value.data = NULL;
+    } else if(UA_Variant_isScalar(&res->value) && outDataType == &UA_TYPES[UA_TYPES_VARIANT]) {
+        memcpy(out, &res->value, sizeof(UA_Variant));
+        UA_Variant_init(&res->value);
     } else {
         retval = UA_STATUSCODE_BADUNEXPECTEDERROR;
     }
@@ -40056,7 +40059,7 @@
 
 #ifdef _WIN32
























     struct tm ptm;
-    gmtime_s(&ptm, &rawtime);
+    ptm = *gmtime(&rawtime);
     // Request that mktime() looksup dst in timezone database
     ptm.tm_isdst = -1;
     gmt = mktime(&ptm);
@@ -41446,9 +41449,13 @@
 
 UA_ServerConfig *
 UA_ServerConfig_new_minimal(UA_UInt16 portNumber,
-                            const UA_ByteString *certificate) {
+                            const UA_ByteString *certificate,
+                            UA_Logger logger) {
     UA_ServerConfig *conf = createDefaultConfig();
 
+    if(logger != NULL)
+        conf->logger = logger;
+
     UA_StatusCode retval = UA_Nodestore_default_new(&conf->nodestore);
     if(retval != UA_STATUSCODE_GOOD) {
         UA_ServerConfig_delete(conf);
@@ -43952,3 +43959,35 @@
 }
 
 #endif /* UA_ENABLE_ENCRYPTION */
+
+UA_StatusCode
+UA_Client_getCustomDataTypes(UA_Client *client, UA_DataType **types, size_t *typesSize) {
+    *types = (UA_DataType *)client->config.customDataTypes;
+    *typesSize = client->config.customDataTypesSize;
+
+    return UA_STATUSCODE_GOOD;
+}
+
+UA_StatusCode
+UA_Client_setCustomDataTypes(UA_Client *client, UA_DataType *types, size_t typesSize) {
+  client->config.customDataTypes = types;
+  client->config.customDataTypesSize = typesSize;
+
+  return UA_STATUSCODE_GOOD;
+}
+
+UA_StatusCode
+UA_Server_getCustomDataTypes(UA_Server *server, UA_DataType **types, size_t *typesSize) {
+    *types = server->config.customDataTypes;
+    *typesSize = server->config.customDataTypesSize;
+
+    return UA_STATUSCODE_GOOD;
+}
+
+UA_StatusCode
+UA_Server_setCustomDataTypes(UA_Server *server, UA_DataType *types, size_t typesSize) {
+  server->config.customDataTypes = types;
+  server->config.customDataTypesSize = typesSize;
+
+  return UA_STATUSCODE_GOOD;
+}
--- open62541.h.orig	2019-07-23 10:51:53.000000000 +0200
+++ open62541.h	2019-07-29 16:06:35.649995287 +0200
@@ -11222,7 +11222,7 @@









  * @param server The server object.
  * @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.
+ *        The default max wait time is 10millisec.
  * @return Returns how long we can wait until the next scheduled
  *         callback (in ms) */
 UA_UInt16 UA_EXPORT
@@ -15541,7 +15541,7 @@
  * @param certificate Optional certificate for the server endpoint. Can be
  *        ``NULL``. */
 UA_EXPORT UA_ServerConfig *
-UA_ServerConfig_new_minimal(UA_UInt16 portNumber, const UA_ByteString *certificate);
+UA_ServerConfig_new_minimal(UA_UInt16 portNumber, const UA_ByteString *certificate, UA_Logger logger);
 
 #ifdef UA_ENABLE_ENCRYPTION
 
@@ -15578,7 +15578,7 @@
  * certificate. */
 static UA_INLINE UA_ServerConfig *
 UA_ServerConfig_new_default(void) {
-    return UA_ServerConfig_new_minimal(4840, NULL);
+    return UA_ServerConfig_new_minimal(4840, NULL, NULL);
 }
 
 /* Set a custom hostname in server configuration
@@ -15661,6 +15661,18 @@
 }
 #endif
 
+UA_StatusCode UA_EXPORT
+UA_Client_getCustomDataTypes(UA_Client *client, UA_DataType **types, size_t *typesSize);
+
+UA_StatusCode UA_EXPORT
+UA_Client_setCustomDataTypes(UA_Client *client, UA_DataType *types, size_t typesSize);
+
+UA_StatusCode UA_EXPORT
+UA_Server_getCustomDataTypes(UA_Server *server, UA_DataType **types, size_t *typesSize);
+
+UA_StatusCode UA_EXPORT
+UA_Server_setCustomDataTypes(UA_Server *server, UA_DataType *types, size_t typesSize);

+
 #ifdef __cplusplus
 } // extern "C"
 #endif




|

|
|
|
|
<
>




|
|
|








|







 







|

|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






|

|
<
<
<
<
<
|
<
<

<
<
<
<
<
<
<
<

<
<
<
<
<
<
<
<
|

<





<
<
<
<
<
<
<
<
|

<



|
|
|
>
>
>
>
>
>
>
>
>








|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<



<
<
<
|


|
|
<
<
>
|
<
<
<
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
..
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80





81


82








83








84
85

86
87
88
89
90








91
92

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117


















118
119
120



121
122
123
124
125


126
127



The following patch relaxes type checking on attribute R/W functions.
This simplifies the "opcua read ..." and "opcua write ..." logic.
Another change allows the server's logger to be fully overriden.
It changes the default timeout to 10 milliseconds and adds some
functions to set the custom data type array on client and server.

--- open62541.c.orig	2019-10-10 17:56:09.000000000 +0200
+++ open62541.c	2019-10-11 15:42:00.506190943 +0200
@@ -22428,7 +22428,7 @@
 /* Main Server Loop */

 /********************/
 
-#define UA_MAXTIMEOUT 50 /* Max timeout in ms between main-loop iterations */
+#define UA_MAXTIMEOUT 10 /* Max timeout in ms between main-loop iterations */
 
 /* Start: Spin up the workers and the network layer and sample the server's
  *        start time.
@@ -41415,7 +41415,7 @@
     UA_WriteValue_init(&wValue);
     wValue.nodeId = *nodeId;
     wValue.attributeId = attributeId;
-    if(attributeId == UA_ATTRIBUTEID_VALUE)
+    if(attributeId == UA_ATTRIBUTEID_VALUE && inDataType == &UA_TYPES[UA_TYPES_VARIANT])
         wValue.value.value = *(const UA_Variant*)in;
     else
         /* hack. is never written into. */
@@ -41518,13 +41518,16 @@
     if(attributeId == UA_ATTRIBUTEID_VALUE) {
         memcpy(out, &res->value, sizeof(UA_Variant));
         UA_Variant_init(&res->value);
-    } else if(attributeId == UA_ATTRIBUTEID_NODECLASS) {
+    } else if(attributeId == UA_ATTRIBUTEID_NODECLASS && outDataType != &UA_TYPES[UA_TYPES_VARIANT]) {
         memcpy(out, (UA_NodeClass*)res->value.data, sizeof(UA_NodeClass));
     } else if(UA_Variant_isScalar(&res->value) &&
................................................................................
         res->value.data = NULL;
+    } else if(UA_Variant_isScalar(&res->value) && outDataType == &UA_TYPES[UA_TYPES_VARIANT]) {
+        memcpy(out, &res->value, sizeof(UA_Variant));
+        UA_Variant_init(&res->value);
     } else {
         retval = UA_STATUSCODE_BADUNEXPECTEDERROR;
     }
@@ -51591,16 +51594,22 @@
 
 static UA_StatusCode
 setDefaultConfig(UA_ServerConfig *conf) {
+    UA_Logger logger;
+
     if (!conf)
         return UA_STATUSCODE_BADINVALIDARGUMENT;
 
+    logger = conf->logger;
+    if (logger.log == NULL)
+        logger = UA_Log_Stdout_;
+
     /* Zero out.. All members have a valid initial value */
     UA_ServerConfig_clean(conf);
     memset(conf, 0, sizeof(UA_ServerConfig));
 
     /* --> Start setting the default static config <-- */
     conf->nThreads = 1;
-    conf->logger = UA_Log_Stdout_;
+    conf->logger = logger;
 
     conf->shutdownDelay = 0.0;
 
@@ -56830,7 +56839,7 @@
     time_t gmt, rawtime = time(NULL);
 
     struct tm ptm;
-    gmtime_s(&ptm, &rawtime);
+    ptm = *gmtime(&rawtime);
     // Request that mktime() looksup dst in timezone database
     ptm.tm_isdst = -1;
     gmt = mktime(&ptm);
@@ -57915,3 +57924,17 @@
 
     return connection;





 }


+








+UA_StatusCode








+UA_Client_setCustomDataTypes(UA_Client *client, const UA_DataTypeArray *types) {
+  client->config.customDataTypes = types;

+
+  return UA_STATUSCODE_GOOD;
+}
+
+UA_StatusCode








+UA_Server_setCustomDataTypes(UA_Server *server, const UA_DataTypeArray *types) {
+  server->config.customDataTypes = types;

+
+  return UA_STATUSCODE_GOOD;
+}
--- open62541.h.orig	2019-10-10 17:56:09.000000000 +0200
+++ open62541.h	2019-10-11 15:40:15.785621699 +0200
@@ -95,7 +95,7 @@
  * On Win32: Define ``UA_DYNAMIC_LINKING`` and ``UA_DYNAMIC_LINKING_EXPORT`` in
  * order to export symbols for a DLL. Define ``UA_DYNAMIC_LINKING`` only to
  * import symbols from a DLL.*/
-#define UA_DYNAMIC_LINKING
+/* #undef UA_DYNAMIC_LINKING */
 
 /* Shortcuts for extern "C" declarations */
 #if !defined(_UA_BEGIN_DECLS)
@@ -23139,7 +23139,7 @@
  * @param server The server object.
  * @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.
+ *        The default max wait time is 10millisec.
  * @return Returns how long we can wait until the next scheduled
  *         callback (in ms) */
 UA_UInt16 UA_EXPORT
@@ -30420,6 +30420,11 @@
 #define UA_fileExists(X) ( UA_access(X, 0) == 0)


















 #endif
 
+UA_StatusCode UA_EXPORT



+UA_Client_setCustomDataTypes(UA_Client *client, const UA_DataTypeArray *types);
+
+UA_StatusCode UA_EXPORT
+UA_Server_setCustomDataTypes(UA_Server *server, const UA_DataTypeArray *types);
 


 _UA_END_DECLS
 



Changes to jni/topcua/open62541/open62541.c.

more than 10,000 changes

Changes to jni/topcua/open62541/open62541.h.

more than 10,000 changes

Changes to jni/topcua/open62541/open62541.pdf.

cannot compute difference between binary files