Merge remote-tracking branch 'origin/master' into merge_14_master_27

This commit is contained in:
Julius Pfrommer 2025-04-23 12:36:26 +02:00
commit e5cd5ac428
15 changed files with 70 additions and 195 deletions

View File

@ -230,23 +230,23 @@ jobs:
echo "New IPv6 status on eth0: $IPV6"
[ "$IPV6" = "0" ] || { echo "Failed to enable IPv6 on eth0"; exit 1; }
- uses: actions/checkout@v4
if: ${{ matrix.build.runs_on == '' || matrix.build.runs_on == matrix.os }}
if: matrix.build.runs_on == '' || matrix.build.runs_on == matrix.os
with:
submodules: true
- name: Install Dependencies
if: ${{ matrix.build.runs_on == '' || matrix.build.runs_on == matrix.os }}
if: matrix.build.runs_on == '' || matrix.build.runs_on == matrix.os
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq build-essential cmake libcap2-bin pkg-config libssl-dev python3-sphinx graphviz check libxml2-dev libpcap-dev
${{ matrix.build.cmd_deps }}
- name: ${{ matrix.build.name }}
if: ${{ matrix.build.runs_on == '' || matrix.build.runs_on == matrix.os }}
if: matrix.build.runs_on == '' || matrix.build.runs_on == matrix.os
shell: bash
run: source tools/ci/ci.sh && ${{ matrix.build.cmd_action }}
env:
ETHERNET_INTERFACE: eth0
- name: Upload coverage to Codecov
if: ${{ matrix.build.runs_on == '' || matrix.build.runs_on == matrix.os }}
if: matrix.build.runs_on == '' || matrix.build.runs_on == matrix.os
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

View File

@ -2,7 +2,7 @@
open62541 (<http://open62541.org>) is an open source implementation of OPC UA (OPC Unified Architecture / IEC 62541) written in the C language. 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. The open62541 library is platform independent: All platform-specific functionality is implemented via exchangeable plugins for easy porting to different (embedded) targets.
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.
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. Some plugins and examples are in the public domain (CC0 license) and some are licensed under MPLv2. The CC0 licensed ones 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.

View File

@ -203,6 +203,8 @@ Most options can be changed manually in :file:`ua_config.h` (:file:`open62541.h`
for the single-file release) after the code generation. But usually there is no
need to adjust them.
.. _build_options:
Main Build Options
^^^^^^^^^^^^^^^^^^

View File

@ -244,7 +244,13 @@
# endif
# elif defined(__has_include) && __has_include(<stdatomic.h>)
# define UA_HAVE_C11_ATOMICS
# include <stdatomic.h>
# ifdef __cplusplus
# include <atomic>
# define _Atomic(T) std::atomic<T>
# define atomic_uintptr_t std::atomic_uintptr_t
# else
# include <stdatomic.h>
# endif
# elif !defined(HAVE_GCC_SYNC_BUILTINS)
# error Atomic operations not implemented
# endif

View File

@ -615,6 +615,7 @@ UA_EXPORT UA_ConnectionManager *
UA_ConnectionManager_new_POSIX_UDP(const UA_String eventSourceName);
#if defined(__linux__) /* Linux only so far */
/**
* Ethernet Connection Manager
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~

49
plugins/README.md Normal file
View File

@ -0,0 +1,49 @@
# open62541 plugins
Specific optional features are implemented using plugins.
They are licensed either under the Mozilla Public License v2.0 (MPLv2) or are in the public domain (CC0 license).
The CC0 licensed plugins can be reused under any license and changes do not have to be published.
Here is an overview of the licenses for all plugins:
| Plugin | License |
| ------------------------------------------------- | ------- |
| ua_accesscontrol_default | CC0 |
| ua_config_default | CC0 |
| ua_config_json | CC0 |
| ua_debug_dump_pkgs | CC0 |
| ua_log_stdout | CC0 |
| ua_log_syslog | CC0 |
| ua_nodesetloader | CC0 |
| ua_nodestore_hashmap | CC0 |
| ua_nodestore_ziptree | CC0 |
| crypto/mbedtls/securitypolicy_common | CC0 |
| crypto/mbedtls/certificategroup | CC0 |
| crypto/ua_certificategroup_none | CC0 |
| crypto/openssl/certificategroup | CC0 |
| crypto/ua_securitypolicy_none | CC0 |
| crypto/ua_filestore_common | MPLv2 |
| crypto/ua_securitypolicy_filestore | MPLv2 |
| crypto/ua_certificategroup_filestore | MPLv2 |
| crypto/mbedtls/create_certificate | MPLv2 |
| crypto/mbedtls/securitypolicy_aes128sha256rsaoaep | MPLv2 |
| crypto/mbedtls/securitypolicy_aes256sha256rsapss | MPLv2 |
| crypto/mbedtls/securitypolicy_basic128rsa15 | MPLv2 |
| crypto/mbedtls/securitypolicy_basic256 | MPLv2 |
| crypto/mbedtls/securitypolicy_basic256sha256 | MPLv2 |
| crypto/mbedtls/securitypolicy_pubsub_aes128ctr | MPLv2 |
| crypto/mbedtls/securitypolicy_pubsub_aes256ctr | MPLv2 |
| crypto/openssl/create_certificate | MPLv2 |
| crypto/openssl/securitypolicy_aes128sha256rsaoaep | MPLv2 |
| crypto/openssl/securitypolicy_aes256sha256rsapss | MPLv2 |
| crypto/openssl/securitypolicy_basic128rsa15 | MPLv2 |
| crypto/openssl/securitypolicy_basic256 | MPLv2 |
| crypto/openssl/securitypolicy_basic256sha256 | MPLv2 |
| crypto/openssl/securitypolicy_common | MPLv2 |
| crypto/openssl/securitypolicy_eccnistp256 | MPLv2 |
| crypto/pkcs11/securitypolicy_pubsub_aes128ctr_tpm | MPLv2 |
| crypto/pkcs11/securitypolicy_pubsub_aes256ctr_tpm | MPLv2 |
| historydata/ua_history_data_backend_memory | MPLv2 |
| historydata/ua_history_data_gathering_default | MPLv2 |
| historydata/ua_history_database_default | MPLv2 |

View File

@ -1422,20 +1422,20 @@ UA_Discovery_addRecord(UA_DiscoveryManager *dm, const UA_String servername,
mdnsd_set_host(mdnsPrivateData.mdnsDaemon, r, fullServiceDomain);
}
/* The first 63 characters of the hostname (or less) */
/* The first 63 characters of the hostname (or less) and ".local." */
size_t maxHostnameLen = UA_MIN(hostname.length, 63);
char localDomain[71];
memcpy(localDomain, hostname.data, maxHostnameLen);
strcpy(localDomain + maxHostnameLen, ".local.");
/* [servername]-[hostname]._opcua-tcp._tcp.local. 86400 IN SRV 0 5 port [hostname]. */
/* [servername]-[hostname]._opcua-tcp._tcp.local. 86400 IN SRV 0 5 port [hostname].local. */
r = mdnsd_unique(mdnsPrivateData.mdnsDaemon, fullServiceDomain,
QTYPE_SRV, 600, UA_Discovery_multicastConflict, dm);
mdnsd_set_srv(mdnsPrivateData.mdnsDaemon, r, 0, 0, port, localDomain);
/* A/AAAA record for all ip addresses.
* [servername]-[hostname]._opcua-tcp._tcp.local. A [ip].
* [hostname]. A [ip]. */
* [hostname].local. A [ip]. */
mdns_set_address_record(dm, fullServiceDomain, localDomain);
/* TXT record: [servername]-[hostname]._opcua-tcp._tcp.local. TXT path=/ caps=NA,DA,... */

View File

@ -1995,7 +1995,9 @@ removeFieldFromEncoding(ParseCtx *ctx, UA_ByteString *encoding, size_t tokenInde
/* Subtract the offset between ctx->json5 end encoding */
start -= objStart;
end -= objStart;
/* Fix: Bounds and sanity check */
if(end < start || end > encoding->length || start > encoding->length)
return;
/* Cut out the field we want to remove */
size_t remaining = encoding->length - end;
memmove(encoding->data + start, encoding->data + end, remaining);

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
set -e
#DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
#BASE_DIR="$( realpath "$DIR/../../../" )"
echo -e "== Building the Debian package =="
/usr/bin/python3 ./tools/prepare_packaging.py
echo -e "--- New debian changelog content ---"
echo "--------------------------------------"
cat ./debian/changelog
echo "--------------------------------------"
#dpkg-buildpackage -b
echo "Test file1" > ../libopen62541_dev.deb
echo "Test file2" > ../libopen62541_tools.deb
if [ $? -ne 0 ] ; then exit 1 ; fi
echo "Copying .deb files to $BUILD_ARTIFACTSTAGINGDIRECTORY"
cp ../libopen62541*.deb $BUILD_ARTIFACTSTAGINGDIRECTORY

View File

@ -1,33 +0,0 @@
#!/usr/bin/env bash
set -e
sudo apt-get update
sudo apt install -y \
check \
cmake \
debhelper \
fakeroot \
git \
graphviz \
latexmk \
libsubunit-dev \
python3-sphinx \
python3-pip \
tar \
texlive-fonts-recommended \
texlive-extra-utils \
texlive-latex-extra \
wget
wget https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.28.2.tar.gz
tar xf mbedtls-2.28.2.tar.gz
cd mbedtls-mbedtls-2.28.2
cmake -DENABLE_TESTING=Off .
make -j
sudo make install
# Pin docutils to version smaller 0.15. Otherwise we run into https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839299
pip install --user 'docutils<=0.14'
pip install --user sphinx_rtd_theme
pip install --user cpplint

View File

@ -1,25 +0,0 @@
cmake_minimum_required(VERSION 3.5)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../../../ ${CMAKE_BINARY_DIR}/lib)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
get_target_property(OPEN62541_SOURCES open62541-object SOURCES)
get_target_property(OPEN62541_INCLUDES open62541-object INCLUDE_DIRECTORIES)
# Create an open62541 component for ESP IDF
set(open62541_component_dir ${CMAKE_CURRENT_LIST_DIR}/components/open62541-lib)
file(MAKE_DIRECTORY ${open62541_component_dir})
file(WRITE ${open62541_component_dir}/CMakeLists.txt "
set(COMPONENT_SRCS ${OPEN62541_SOURCES})
set(COMPONENT_ADD_INCLUDEDIRS ${OPEN62541_INCLUDES})
set(COMPONENT_REQUIRES lwip mbedtls freertos)
register_component()
")
add_definitions(-DUA_ARCHITECTURE_FREERTOSLWIP)
project(hello-world)
add_dependencies(open62541-lib open62541-code-generation)

View File

@ -1,44 +0,0 @@
#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BASE_DIR="$( realpath "$DIR/../../../" )"
echo "== freeRTOS Build =="
# Add xtensa compiler to path
export PATH=$PATH:$IDF_PATH/xtensa-esp32-elf/bin
mkdir -p build_freertos && cd build_freertos
CMAKE_ARGS="-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_TOOLCHAIN_FILE=${IDF_PATH}/tools/cmake/toolchain-esp32.cmake \
-DUA_ARCHITECTURE=freertosLWIP \
-DUA_ARCH_EXTRA_INCLUDES=${IDF_PATH}/components/freertos/include/freertos \
-DUA_BUILD_EXAMPLES=OFF"
# We first need to call cmake separately to generate the required source code. Then we can call the freeRTOS CMake
mkdir lib && cd lib
cmake \
${CMAKE_ARGS} \
${BASE_DIR}
if [ $? -ne 0 ] ; then exit 1 ; fi
make -j open62541-code-generation
if [ $? -ne 0 ] ; then exit 1 ; fi
# Now call the freeRTOS CMake with same arguments
cd ..
cmake \
${CMAKE_ARGS} \
${BASE_DIR}/tools/azure-devops/freeRTOS/
if [ $? -ne 0 ] ; then exit 1 ; fi
# NOTE!!!
# If you came here to see how to build your own version for the ESP32,
# make sure to call `make menuconfig` first and configure the options.
make hello-world.elf
if [ $? -ne 0 ] ; then exit 1 ; fi

View File

@ -1,6 +0,0 @@
set(COMPONENT_REQUIRES open62541-lib )
set(COMPONENT_PRIV_REQUIRES spi_flash )
set(COMPONENT_SRCS hello_world_main.c)
set(COMPONENT_ADD_INCLUDEDIRS "")
register_component()

View File

@ -1,40 +0,0 @@
/* Hello World Example
This example code is in the Public Domain (or CC0 licensed, at your option.)
Unless required by applicable law or agreed to in writing, this
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_system.h"
#include "esp_spi_flash.h"
void app_main()
{
printf("Hello world!\n");
/* Print chip information */
esp_chip_info_t chip_info;
esp_chip_info(&chip_info);
printf("This is ESP32 chip with %d CPU cores, WiFi%s%s, ",
chip_info.cores,
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : "");
printf("silicon revision %d, ", chip_info.revision);
printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024),
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
for (int i = 10; i >= 0; i--) {
printf("Restarting in %d seconds...\n", i);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
printf("Restarting now.\n");
fflush(stdout);
esp_restart();
}

View File

@ -1,16 +0,0 @@
#!/usr/bin/env bash
set -e
sudo apt-get update
sudo apt install -y cmake python3-pip check libsubunit-dev wget tar git
git clone -b v3.2.3 --recursive https://github.com/espressif/esp-idf.git $IDF_PATH
cd $IDF_PATH
python -m pip install wheel
python -m pip install --user -r $IDF_PATH/requirements.txt
# See https://docs.espressif.com/projects/esp-idf/en/stable/get-started/linux-setup.html#toolchain-setup
wget -q https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz
tar -xf xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz -C $IDF_PATH
rm xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz