├── .dockerignore ├── .gitattributes ├── .gitignore ├── CMakeLists.txt ├── Changelog.txt ├── Dockerfile ├── README.md ├── build_linux.sh ├── build_ualds.bat ├── build_ualds_win64.bat ├── build_win32.bat ├── build_win64.bat ├── buildversion.h ├── config.h ├── docker-compose.yml ├── docker-initd.sh ├── etc ├── ualds.conf └── ualds.ini ├── fetch_openssl.bat ├── fetch_openssl_win64.bat ├── findservers.c ├── findserversonnetwork.c ├── findserversonnetwork.h ├── getendpoints.c ├── linux ├── daemon.c ├── daemon.h ├── log.c ├── log.h ├── platform.c └── platform.h ├── main.c ├── mdns ├── CMakeLists.txt ├── CommonServices.h ├── DebugServices.c ├── DebugServices.h ├── GenLinkedList.c ├── GenLinkedList.h ├── WinVersRes.h ├── dll.rc ├── dllmain.c ├── dns_sd.h ├── dnssd.def ├── dnssd.rc ├── dnssd_clientlib.c ├── dnssd_clientstub.c ├── dnssd_ipc.c ├── dnssd_ipc.h ├── mDNSDebug.h ├── mDNSEmbeddedAPI.h └── resource.h ├── registerserver.c ├── registerserver2.c ├── settings.c ├── settings.h ├── settingstests.c ├── stack ├── CMakeLists.txt ├── Changelog.txt ├── README ├── README.md ├── Stack │ ├── AnsiCStack_VS2013.vcxproj │ ├── AnsiCStack_VS2013.vcxproj.filters │ ├── CMakeLists.txt │ ├── core │ │ ├── opcua.h │ │ ├── opcua_buffer.c │ │ ├── opcua_buffer.h │ │ ├── opcua_config.h │ │ ├── opcua_core.c │ │ ├── opcua_core.h │ │ ├── opcua_cryptofactory.h │ │ ├── opcua_datetime.c │ │ ├── opcua_datetime.h │ │ ├── opcua_errorhandling.h │ │ ├── opcua_exclusions.h │ │ ├── opcua_guid.c │ │ ├── opcua_guid.h │ │ ├── opcua_list.c │ │ ├── opcua_list.h │ │ ├── opcua_memory.c │ │ ├── opcua_memory.h │ │ ├── opcua_memorystream.c │ │ ├── opcua_memorystream.h │ │ ├── opcua_mutex.h │ │ ├── opcua_pkifactory.h │ │ ├── opcua_proxystub.c │ │ ├── opcua_proxystub.h │ │ ├── opcua_semaphore.h │ │ ├── opcua_socket.h │ │ ├── opcua_stackstatuscodes.h │ │ ├── opcua_statuscodes.h │ │ ├── opcua_string.c │ │ ├── opcua_string.h │ │ ├── opcua_thread.c │ │ ├── opcua_thread.h │ │ ├── opcua_timer.c │ │ ├── opcua_timer.h │ │ ├── opcua_trace.c │ │ ├── opcua_trace.h │ │ ├── opcua_utilities.c │ │ └── opcua_utilities.h │ ├── linux_gcc.mak │ ├── platforms │ │ ├── linux │ │ │ ├── opcua_p_binary.c │ │ │ ├── opcua_p_binary.h │ │ │ ├── opcua_p_crypto.h │ │ │ ├── opcua_p_cryptofactory.c │ │ │ ├── opcua_p_cryptofactory.h │ │ │ ├── opcua_p_datetime.c │ │ │ ├── opcua_p_datetime.h │ │ │ ├── opcua_p_guid.c │ │ │ ├── opcua_p_guid.h │ │ │ ├── opcua_p_interface.c │ │ │ ├── opcua_p_interface.h │ │ │ ├── opcua_p_internal.c │ │ │ ├── opcua_p_internal.h │ │ │ ├── opcua_p_memory.c │ │ │ ├── opcua_p_memory.h │ │ │ ├── opcua_p_mutex.c │ │ │ ├── opcua_p_mutex.h │ │ │ ├── opcua_p_openssl.c │ │ │ ├── opcua_p_openssl.h │ │ │ ├── opcua_p_openssl_aes.c │ │ │ ├── opcua_p_openssl_hmac_sha.c │ │ │ ├── opcua_p_openssl_nosecurity.c │ │ │ ├── opcua_p_openssl_pki.c │ │ │ ├── opcua_p_openssl_pki.h │ │ │ ├── opcua_p_openssl_pki_nosecurity.c │ │ │ ├── opcua_p_openssl_random.c │ │ │ ├── opcua_p_openssl_rsa.c │ │ │ ├── opcua_p_openssl_sha.c │ │ │ ├── opcua_p_openssl_x509.c │ │ │ ├── opcua_p_pki.h │ │ │ ├── opcua_p_pkifactory.c │ │ │ ├── opcua_p_pkifactory.h │ │ │ ├── opcua_p_semaphore.c │ │ │ ├── opcua_p_semaphore.h │ │ │ ├── opcua_p_socket.c │ │ │ ├── opcua_p_socket.h │ │ │ ├── opcua_p_socket_interface.c │ │ │ ├── opcua_p_socket_interface.h │ │ │ ├── opcua_p_socket_internal.c │ │ │ ├── opcua_p_socket_internal.h │ │ │ ├── opcua_p_socket_ssl.c │ │ │ ├── opcua_p_socket_ssl.h │ │ │ ├── opcua_p_socket_udp.c │ │ │ ├── opcua_p_socket_udp.h │ │ │ ├── opcua_p_string.c │ │ │ ├── opcua_p_string.h │ │ │ ├── opcua_p_thread.c │ │ │ ├── opcua_p_thread.h │ │ │ ├── opcua_p_timer.c │ │ │ ├── opcua_p_timer.h │ │ │ ├── opcua_p_trace.c │ │ │ ├── opcua_p_trace.h │ │ │ ├── opcua_p_types.h │ │ │ ├── opcua_p_utilities.c │ │ │ ├── opcua_p_utilities.h │ │ │ └── opcua_platformdefs.h │ │ └── win32 │ │ │ ├── opcua_p_binary.c │ │ │ ├── opcua_p_binary.h │ │ │ ├── opcua_p_crypto.h │ │ │ ├── opcua_p_cryptofactory.c │ │ │ ├── opcua_p_cryptofactory.h │ │ │ ├── opcua_p_datetime.c │ │ │ ├── opcua_p_datetime.h │ │ │ ├── opcua_p_guid.c │ │ │ ├── opcua_p_guid.h │ │ │ ├── opcua_p_interface.c │ │ │ ├── opcua_p_interface.h │ │ │ ├── opcua_p_internal.c │ │ │ ├── opcua_p_internal.h │ │ │ ├── opcua_p_memory.c │ │ │ ├── opcua_p_memory.h │ │ │ ├── opcua_p_mutex.c │ │ │ ├── opcua_p_mutex.h │ │ │ ├── opcua_p_openssl.c │ │ │ ├── opcua_p_openssl.h │ │ │ ├── opcua_p_openssl_aes.c │ │ │ ├── opcua_p_openssl_hmac_sha.c │ │ │ ├── opcua_p_openssl_nosecurity.c │ │ │ ├── opcua_p_openssl_pki.c │ │ │ ├── opcua_p_openssl_pki.h │ │ │ ├── opcua_p_openssl_pki_nosecurity.c │ │ │ ├── opcua_p_openssl_random.c │ │ │ ├── opcua_p_openssl_rsa.c │ │ │ ├── opcua_p_openssl_sha.c │ │ │ ├── opcua_p_openssl_x509.c │ │ │ ├── opcua_p_pki.h │ │ │ ├── opcua_p_pkifactory.c │ │ │ ├── opcua_p_pkifactory.h │ │ │ ├── opcua_p_semaphore.c │ │ │ ├── opcua_p_semaphore.h │ │ │ ├── opcua_p_socket.c │ │ │ ├── opcua_p_socket.h │ │ │ ├── opcua_p_socket_interface.c │ │ │ ├── opcua_p_socket_interface.h │ │ │ ├── opcua_p_socket_internal.c │ │ │ ├── opcua_p_socket_internal.h │ │ │ ├── opcua_p_socket_ssl.c │ │ │ ├── opcua_p_socket_ssl.h │ │ │ ├── opcua_p_socket_udp.c │ │ │ ├── opcua_p_socket_udp.h │ │ │ ├── opcua_p_string.c │ │ │ ├── opcua_p_string.h │ │ │ ├── opcua_p_thread.c │ │ │ ├── opcua_p_thread.h │ │ │ ├── opcua_p_timer.c │ │ │ ├── opcua_p_timer.h │ │ │ ├── opcua_p_trace.c │ │ │ ├── opcua_p_trace.h │ │ │ ├── opcua_p_types.h │ │ │ ├── opcua_p_utilities.c │ │ │ ├── opcua_p_utilities.h │ │ │ ├── opcua_p_win32_pki.c │ │ │ ├── opcua_p_win32_pki.h │ │ │ └── opcua_platformdefs.h │ ├── proxystub │ │ └── serverstub │ │ │ ├── opcua_endpoint.c │ │ │ ├── opcua_endpoint.h │ │ │ ├── opcua_endpoint_internal.h │ │ │ ├── opcua_serverapi.c │ │ │ ├── opcua_serverapi.h │ │ │ ├── opcua_serverstub.h │ │ │ ├── opcua_servicetable.c │ │ │ └── opcua_servicetable.h │ ├── securechannel │ │ ├── opcua_securechannel_types.h │ │ ├── opcua_secureconnection.c │ │ ├── opcua_secureconnection.h │ │ ├── opcua_securelistener.c │ │ ├── opcua_securelistener.h │ │ ├── opcua_securelistener_channelmanager.c │ │ ├── opcua_securelistener_channelmanager.h │ │ ├── opcua_securelistener_policymanager.c │ │ ├── opcua_securelistener_policymanager.h │ │ ├── opcua_securestream.c │ │ ├── opcua_securestream.h │ │ ├── opcua_soapsecurechannel.c │ │ ├── opcua_soapsecurechannel.h │ │ ├── opcua_tcpsecurechannel.c │ │ └── opcua_tcpsecurechannel.h │ ├── stackcore │ │ ├── opcua_attributes.h │ │ ├── opcua_binarydecoder.c │ │ ├── opcua_binaryencoder.c │ │ ├── opcua_binaryencoder.h │ │ ├── opcua_binaryencoderinternal.h │ │ ├── opcua_browsenames.h │ │ ├── opcua_builtintypes.c │ │ ├── opcua_builtintypes.h │ │ ├── opcua_connection.c │ │ ├── opcua_connection.h │ │ ├── opcua_credentials.h │ │ ├── opcua_crypto.c │ │ ├── opcua_crypto.h │ │ ├── opcua_decoder.c │ │ ├── opcua_decoder.h │ │ ├── opcua_encodeableobject.c │ │ ├── opcua_encodeableobject.h │ │ ├── opcua_encoder.c │ │ ├── opcua_encoder.h │ │ ├── opcua_enumeratedtype.c │ │ ├── opcua_enumeratedtype.h │ │ ├── opcua_extensionobject.c │ │ ├── opcua_extensionobject.h │ │ ├── opcua_identifiers.h │ │ ├── opcua_listener.c │ │ ├── opcua_listener.h │ │ ├── opcua_messagecontext.c │ │ ├── opcua_messagecontext.h │ │ ├── opcua_pki.c │ │ ├── opcua_pki.h │ │ ├── opcua_securechannel.c │ │ ├── opcua_securechannel.h │ │ ├── opcua_stream.c │ │ ├── opcua_stream.h │ │ ├── opcua_stringtable.c │ │ ├── opcua_stringtable.h │ │ ├── opcua_types.c │ │ └── opcua_types.h │ ├── transport │ │ ├── https │ │ │ ├── opcua_https_internal.c │ │ │ ├── opcua_https_internal.h │ │ │ ├── opcua_httpsconnection.c │ │ │ ├── opcua_httpsconnection.h │ │ │ ├── opcua_httpslistener.c │ │ │ ├── opcua_httpslistener.h │ │ │ ├── opcua_httpslistener_connectionmanager.c │ │ │ ├── opcua_httpslistener_connectionmanager.h │ │ │ ├── opcua_httpsstream.c │ │ │ └── opcua_httpsstream.h │ │ └── tcp │ │ │ ├── opcua_tcpconnection.c │ │ │ ├── opcua_tcpconnection.h │ │ │ ├── opcua_tcplistener.c │ │ │ ├── opcua_tcplistener.h │ │ │ ├── opcua_tcplistener_connectionmanager.c │ │ │ ├── opcua_tcplistener_connectionmanager.h │ │ │ ├── opcua_tcpstream.c │ │ │ └── opcua_tcpstream.h │ └── win32_msc.mak ├── build_linux.sh ├── build_win32.bat ├── build_win64.bat ├── linux_gcc.mak └── linux_gcc_rules.mak ├── strlcat.c ├── strlcpy.c ├── tlds-alpha-by-domain.h ├── ualds.c ├── ualds.h ├── utils.c ├── utils.h ├── win32 ├── certstore.c ├── certstore.h ├── daemon.c ├── daemon.h ├── getopt.c ├── getopt.h ├── log.c ├── log.h ├── platform.c ├── platform.h ├── service.c ├── service.h ├── ualds.ico ├── version.rc ├── win_version.h └── winmain.c ├── zeroconf.c └── zeroconf.h /.dockerignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | # 3 | # The source code in this file is covered under a dual-license scenario: 4 | # - RCL: for OPC Foundation members in good-standing 5 | # - GPL V2: everybody else 6 | # 7 | # RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | # 9 | # GNU General Public License as published by the Free Software Foundation; 10 | # version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | # 12 | # This source code is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # ignore generated files 17 | 18 | *bin/* 19 | .vscode/** 20 | build/** 21 | pki/** 22 | */Debug/* 23 | */Release/* 24 | *.o 25 | *.a 26 | *.lib 27 | *.obj 28 | *.db 29 | *.opendb 30 | *.log 31 | *.tlog 32 | *.idb 33 | *.suo 34 | *.pdb 35 | *.exe 36 | *.ilk 37 | *.iobj 38 | *.ipdb 39 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | # 3 | # The source code in this file is covered under a dual-license scenario: 4 | # - RCL: for OPC Foundation members in good-standing 5 | # - GPL V2: everybody else 6 | # 7 | # RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | # 9 | # GNU General Public License as published by the Free Software Foundation; 10 | # version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | # 12 | # This source code is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | 16 | * text=auto 17 | *.c text 18 | *.sln text eol=crlf 19 | *.sh text eol=lf 20 | *.conf eol=lf 21 | Dockerfile eol=lf 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | # 3 | # The source code in this file is covered under a dual-license scenario: 4 | # - RCL: for OPC Foundation members in good-standing 5 | # - GPL V2: everybody else 6 | # 7 | # RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | # 9 | # GNU General Public License as published by the Free Software Foundation; 10 | # version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | # 12 | # This source code is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # ignore generated files 17 | 18 | *bin/* 19 | .vscode/** 20 | build/** 21 | pki/** 22 | */Debug/* 23 | */Release/* 24 | *.o 25 | *.a 26 | *.lib 27 | *.obj 28 | *.db 29 | *.opendb 30 | *.log 31 | *.tlog 32 | *.idb 33 | *.suo 34 | *.pdb 35 | *.exe 36 | *.ilk 37 | *.iobj 38 | *.ipdb 39 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bookworm-slim 2 | 3 | ADD / /lds 4 | 5 | RUN \ 6 | set -ex \ 7 | && \ 8 | apt-get update && apt-get install -y \ 9 | build-essential \ 10 | git cmake \ 11 | libcurl4-openssl-dev libssl-dev \ 12 | libavahi-compat-libdnssd-dev \ 13 | dbus rsyslog avahi-daemon avahi-utils \ 14 | && \ 15 | rm -rf /lds/build && mkdir /lds/build && cd /lds/build \ 16 | && cmake .. && cmake --build . \ 17 | && \ 18 | cp /lds/docker-initd.sh /etc/init.d/lds \ 19 | && echo "service rsyslog start" >> /etc/init.d/lds \ 20 | && echo "service dbus start" >> /etc/init.d/lds \ 21 | && echo "avahi-daemon --no-drop-root --daemonize --syslog" >> /etc/init.d/lds \ 22 | && echo "./lds/build/bin/opcualds -c /lds/etc/ualds.conf " >> /etc/init.d/lds \ 23 | && chmod +x /etc/init.d/lds 24 | 25 | EXPOSE 5353 26 | 27 | ENTRYPOINT service lds start && tail -f /var/log/opcualds.log 28 | 29 | -------------------------------------------------------------------------------- /build_linux.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -e 3 | rm -rf build 4 | mkdir build 5 | cd build 6 | mkdir Release 7 | cd Release 8 | cmake -DCMAKE_BUILD_TYPE=Release ../.. && cmake --build . 9 | cd .. 10 | mkdir Debug 11 | cd Debug 12 | cmake -DCMAKE_BUILD_TYPE=Debug ../.. && cmake --build . 13 | cd .. 14 | cd .. -------------------------------------------------------------------------------- /build_ualds.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | REM **************************************************************************************************************** 3 | REM ** This script builds the UA-LDS. 4 | REM ** This must be run from a Visual Studio command line. 5 | REM **************************************************************************************************************** 6 | SETLOCAL 7 | 8 | set SRCDIR=%~dp0 9 | set INSTALLDIR=%~dp0 10 | set SIGNTOOL=C:\Build\sign_output.bat 11 | set ZIP="C:\Program Files\7-zip\7z.exe" 12 | set VS_CONFIG=RelWithDebInfo 13 | set LDSFN=OPC UA Local Discovery Server 14 | 15 | set GIT=C:\Program Files\Git\bin\git.exe 16 | IF NOT EXIST "%GIT%" SET GIT=C:\Program Files (x86)\Git\bin\git.exe 17 | 18 | ECHO STEP 1) Deleting Output Directories 19 | REM IF EXIST %INSTALLDIR%\bin rmdir /s /q %INSTALLDIR%\bin 20 | 21 | IF "%1"=="no-stack" GOTO noStack 22 | ECHO STEP 2) Fetch OpenSSL 23 | REM IF EXIST %INSTALLDIR%\stack\openssl rmdir /s /q %INSTALLDIR%\stack\openssl 24 | CALL fetch_openssl.bat 25 | 26 | ECHO STEP 3) Building Stack 27 | cd %SRCDIR%\stack 28 | CALL build_win32.bat 29 | set code=%errorlevel% 30 | if not %code%==0 goto :error 31 | :noStack 32 | 33 | ECHO STEP 4) Update Build Number 34 | cd %SRCDIR% 35 | 36 | IF NOT DEFINED BUILD_VERSION SET BUILD_VERSION=413 37 | IF NOT DEFINED BUILD_NUMBER SET BUILD_NUMBER=1 38 | ECHO Building Version: %BUILD_VERSION%.%BUILD_NUMBER% 39 | 40 | perl -pi.bak -e "s/XXX/%BUILD_VERSION%/;" .\config.h 41 | perl -pi.bak -e "s/YYY/%BUILD_NUMBER%/;" .\config.h 42 | del /Q *.bak 43 | 44 | ECHO STEP 5) Building LDS 45 | cd %SRCDIR% 46 | CALL build_win32.bat 47 | set code=%errorlevel% 48 | if not %code%==0 goto :error 49 | 50 | ECHO STEP 6) Sign the Binaries 51 | IF EXIST "%SIGNTOOL%" CALL "%SIGNTOOL%" %INSTALLDIR%\build\bin\%VS_CONFIG%\*.dll /dual 52 | IF EXIST "%SIGNTOOL%" CALL "%SIGNTOOL%" %INSTALLDIR%\build\bin\%VS_CONFIG%\*.exe /dual 53 | 54 | ECHO STEP 7) ZIP the Binaries 55 | %ZIP% a "%LDSFN%.zip" "%INSTALLDIR%\build\bin\%VS_CONFIG%\*.exe" 56 | %ZIP% a "%LDSFN%.zip" "%INSTALLDIR%\build\bin\%VS_CONFIG%\*.dll" 57 | 58 | goto :end 59 | 60 | :error 61 | echo build failed with exit code %code% 62 | popd 63 | exit /b %code% 64 | 65 | :end 66 | ECHO *** ALL DONE *** 67 | 68 | ENDLOCAL 69 | -------------------------------------------------------------------------------- /build_ualds_win64.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | REM **************************************************************************************************************** 3 | REM ** This script builds the UA-LDS. 4 | REM ** This must be run from a Visual Studio command line. 5 | REM **************************************************************************************************************** 6 | SETLOCAL 7 | 8 | set SRCDIR=%~dp0 9 | set INSTALLDIR=%~dp0 10 | set SIGNTOOL=C:\Build\sign_output.bat 11 | set ZIP="C:\Program Files\7-zip\7z.exe" 12 | set VS_CONFIG=RelWithDebInfo 13 | set LDSFN=OPC UA Local Discovery Server 14 | 15 | set GIT=C:\Program Files\Git\bin\git.exe 16 | IF NOT EXIST "%GIT%" SET GIT=C:\Program Files (x86)\Git\bin\git.exe 17 | 18 | ECHO STEP 1) Deleting Output Directories 19 | REM IF EXIST %INSTALLDIR%\bin rmdir /s /q %INSTALLDIR%\bin 20 | 21 | IF "%1"=="no-stack" GOTO noStack 22 | ECHO STEP 2) Fetch OpenSSL 23 | REM IF EXIST %INSTALLDIR%\stack\openssl rmdir /s /q %INSTALLDIR%\stack\openssl 24 | CALL fetch_openssl_win64.bat 25 | 26 | ECHO STEP 3) Building Stack 27 | cd %SRCDIR%\stack 28 | CALL build_win64.bat 29 | :noStack 30 | 31 | ECHO STEP 4) Update Build Number 32 | cd %SRCDIR% 33 | 34 | IF NOT DEFINED BUILD_VERSION SET BUILD_VERSION=413 35 | IF NOT DEFINED BUILD_NUMBER SET BUILD_NUMBER=1 36 | ECHO Building Version: %BUILD_VERSION%.%BUILD_NUMBER% 37 | 38 | perl -pi.bak -e "s/XXX/%BUILD_VERSION%/;" .\config.h 39 | perl -pi.bak -e "s/YYY/%BUILD_NUMBER%/;" .\config.h 40 | del /Q *.bak 41 | 42 | ECHO STEP 5) Building LDS 43 | cd %SRCDIR% 44 | CALL build_win64.bat 45 | 46 | ECHO STEP 6) Sign the Binaries 47 | IF EXIST "%SIGNTOOL%" CALL "%SIGNTOOL%" %INSTALLDIR%\build\bin\%VS_CONFIG%\*.dll /dual 48 | IF EXIST "%SIGNTOOL%" CALL "%SIGNTOOL%" %INSTALLDIR%\build\bin\%VS_CONFIG%\*.exe /dual 49 | 50 | ECHO STEP 7) ZIP the Binaries 51 | %ZIP% a "%LDSFN%.zip" "%INSTALLDIR%\build\bin\%VS_CONFIG%\*.exe" 52 | %ZIP% a "%LDSFN%.zip" "%INSTALLDIR%\build\bin\%VS_CONFIG%\*.dll" 53 | 54 | ECHO *** ALL DONE *** 55 | GOTO theEnd 56 | 57 | :theEnd 58 | ENDLOCAL 59 | -------------------------------------------------------------------------------- /build_win32.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if exist build rd /s /q build 4 | mkdir build 5 | pushd build 6 | 7 | cmake -T "v140_xp" -G "Visual Studio 14 2015" .. 8 | set code=%errorlevel% 9 | if not %code%==0 goto :error 10 | 11 | cmake --build . --config Release 12 | set code=%errorlevel% 13 | if not %code%==0 goto :error 14 | 15 | cmake --build . --config RelWithDebInfo 16 | set code=%errorlevel% 17 | if not %code%==0 goto :error 18 | 19 | cmake --build . --config Debug 20 | set code=%errorlevel% 21 | if not %code%==0 goto :error 22 | 23 | popd 24 | goto :end 25 | 26 | :error 27 | echo cmake failed with exit code %code% 28 | popd 29 | exit /b %code% 30 | 31 | :end -------------------------------------------------------------------------------- /build_win64.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if exist build rd /s /q build 3 | mkdir build 4 | pushd build 5 | cmake -T "v140_xp" -G "Visual Studio 14 2015 Win64" .. 6 | cmake --build . --config Release 7 | cmake --build . --config RelWithDebInfo 8 | cmake --build . --config Debug 9 | popd 10 | -------------------------------------------------------------------------------- /buildversion.h: -------------------------------------------------------------------------------- 1 | #define BUILD_NUMBER 11 2 | -------------------------------------------------------------------------------- /config.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __CONFIG_H__ 18 | #define __CONFIG_H__ 19 | 20 | /* default install prefix */ 21 | #ifndef PREFIX 22 | # define PREFIX "/opt/opcfoundation" 23 | #endif 24 | 25 | /* platform checks */ 26 | /* #undef HAVE_STRLCAT */ 27 | /* #undef HAVE_STRLCPY */ 28 | 29 | /* stringify macros */ 30 | #define xstr(s) str(s) 31 | #define str(s) #s 32 | 33 | #include "buildversion.h" 34 | 35 | /* define version information */ 36 | #define UALDS_CONF_VERSION_MAJOR 1 37 | #define UALDS_CONF_VERSION_MINOR 04 38 | #define UALDS_CONF_VERSION_PATCH XXX 39 | #define UALDS_CONF_VERSION_BUILD YYY 40 | #define UALDS_VERSION_SUFFIX " Release" 41 | #define UALDS_CONF_VERSION_STRING xstr(UALDS_CONF_VERSION_MAJOR) "." \ 42 | xstr(UALDS_CONF_VERSION_MINOR) "." xstr(UALDS_CONF_VERSION_PATCH) "." \ 43 | xstr(UALDS_CONF_VERSION_BUILD) UALDS_VERSION_SUFFIX 44 | 45 | /* maximum length of URIs and URLs. */ 46 | #define UALDS_CONF_MAX_URI_LENGTH 256 47 | /* maximum length of a settings key */ 48 | #define UALDS_CONF_MAX_KEY_LENGTH 50 49 | 50 | /* Windows specific section */ 51 | #ifdef _WIN32 52 | /* Service Configuration */ 53 | # define UALDS_CONF_SERVICE_NAME TEXT("UALDS") 54 | # define UALDS_CONF_SERVICE_DISPLAYNAME TEXT("OPC UA Local Discovery Server") 55 | # define UALDS_CONF_SERVICE_DESCRIPTION TEXT("The Local Discovery Server allows UA clients to discover UA servers running on the local machine."); 56 | /* Windows certificate store */ 57 | # if OPCUA_SUPPORT_PKI_WIN32 58 | # define UALDS_CONF_WIN32_STORE_LOCATION OPCUA_P_PKI_WIN32_STORE_MACHINE 59 | # define UALDS_CONF_WIN32_STORE_NAME "UA Applications" 60 | # endif /* OPCUA_SUPPORT_PKI_WIN32 */ 61 | #endif 62 | 63 | /* Linux specific section */ 64 | /* pid file: default=/var/run/ualds.pid */ 65 | #define UALDS_CONF_PID_FILE "/var/run/ualds/ualds.pid" 66 | #define UALDS_CONF_LOG_TARGET UALDS_LOG_FILE 67 | #define UALDS_CONF_LOG_LEVEL UALDS_LOG_DEBUG 68 | #define UALDS_CONF_SYSLOG_IDENT "ualds" 69 | #define UALDS_CONF_SYSLOG_FACILITY LOG_LOCAL0 70 | 71 | // Bonjour Service Names 72 | # define APPLE_BONJOUR_SERVICE_NAME TEXT("Bonjour Service") 73 | # define OPCF_BONJOUR_SERVICE_NAME TEXT("OPCF Bonjour Service") 74 | 75 | #endif /* __CONFIG_H__ */ 76 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.4" 2 | 3 | services: 4 | lds: 5 | image: lds:latest 6 | build: 7 | dockerfile: Dockerfile 8 | #hostname: lds 9 | #ports: 10 | # - 5353:5353/udp 11 | # - 4840:4840 12 | restart: always 13 | volumes: 14 | - ./UALDS-data/config:/lds/etc 15 | - ./UALDS-data/pki:/opt/opcfoundation/ualds/pki 16 | - ./UALDS-data/logs:/var/log/ 17 | # using network_mode: host to ensure working mDNS Broadcast/Receive 18 | # alternatively you can uncomment the port config - make sure to properly set the hostname, so the mDNS Broadcast points to your actual host 19 | network_mode: host 20 | -------------------------------------------------------------------------------- /docker-initd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 3 | # 4 | # The source code in this file is covered under a dual-license scenario: 5 | # - RCL: for OPC Foundation members in good-standing 6 | # - GPL V2: everybody else 7 | # 8 | # RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 9 | # 10 | # GNU General Public License as published by the Free Software Foundation; 11 | # version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 12 | # 13 | # This source code is distributed in the hope that it will be useful, 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 | # 17 | 18 | case "$1" in 19 | start) 20 | $DAEMON 21 | ;; 22 | stop|reload|restart|force-reload) 23 | echo "Not supported" 24 | exit 1 25 | ;; 26 | status) 27 | exit 0 28 | ;; 29 | *) 30 | exit 1 31 | ;; 32 | esac 33 | -------------------------------------------------------------------------------- /fetch_openssl.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | REM **************************************************************************************************************** 3 | REM ** This script builds the debug version of OpenSSL for use by the ANSI C samples. 4 | REM ** It requires that PERL be installed in the path and it must be run from a Visual Studio command line. 5 | REM **************************************************************************************************************** 6 | SETLOCAL 7 | 8 | set ROOT=%~dp0 9 | set SRCDIR=openssl-3.1.7 10 | set GITTAG=openssl-3.1.7 11 | 12 | set GIT=C:\Program Files\Git\bin\git.exe 13 | IF NOT EXIST "%GIT%" SET GIT=C:\Program Files (x86)\Git\bin\git.exe 14 | 15 | cd %ROOT%\stack 16 | IF NOT EXIST %SRCDIR% "%GIT%" clone https://github.com/openssl/openssl.git %SRCDIR% 17 | cd %SRCDIR% 18 | "%GIT%" checkout tags/%GITTAG% 19 | 20 | cd %ROOT%\stack 21 | perl -pi.back -e "s/openssl-3.\?.\?/%SRCDIR%/" build_win32.bat 22 | -------------------------------------------------------------------------------- /fetch_openssl_win64.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | REM **************************************************************************************************************** 3 | REM ** This script builds the debug version of OpenSSL for use by the ANSI C samples. 4 | REM ** It requires that PERL be installed in the path and it must be run from a Visual Studio command line. 5 | REM **************************************************************************************************************** 6 | SETLOCAL 7 | 8 | set ROOT=%~dp0 9 | set SRCDIR=openssl-3.1.7 10 | set GITTAG=openssl-3.1.7 11 | 12 | set GIT=C:\Program Files\Git\bin\git.exe 13 | IF NOT EXIST "%GIT%" SET GIT=C:\Program Files (x86)\Git\bin\git.exe 14 | 15 | cd %ROOT%\stack 16 | IF NOT EXIST %SRCDIR% "%GIT%" clone https://github.com/openssl/openssl.git %SRCDIR% 17 | cd %SRCDIR% 18 | "%GIT%" checkout tags/%GITTAG% 19 | 20 | cd %ROOT%\stack 21 | perl -pi.back -e "s/openssl-3.\?.\?/%SRCDIR%/" build_win64.bat 22 | -------------------------------------------------------------------------------- /findserversonnetwork.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual - license scenario : 4 | - RCL: for OPC Foundation members in good - standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code.See http ://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code.See http ://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __FINDSERVERSONNETWORK_H__ 18 | #define __FINDSERVERSONNETWORK_H__ 19 | 20 | #include 21 | 22 | OpcUa_StatusCode ualds_findserversonnetwork_start_listening(); 23 | void ualds_findserversonnetwork_stop_listening(); 24 | 25 | void ualds_findserversonnetwork_socketEventCallback(int *shutdown); 26 | 27 | void ualds_zeroconf_register_offline(const char *szServerUri); 28 | void ualds_zeroconf_unregister_offline(const char *szServerUri); 29 | void ualds_zeroconf_load_offline(); 30 | void ualds_zeroconf_cleanup_offline(); 31 | 32 | #endif /* __FINDSERVERSONNETWORK_H__ */ 33 | -------------------------------------------------------------------------------- /linux/daemon.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | /* uastack includes */ 18 | #include 19 | /* local platform includes */ 20 | #include 21 | /* locale includes */ 22 | #include "../config.h" 23 | #include "../ualds.h" 24 | #include "log.h" 25 | 26 | void signal_handler(int sig) 27 | { 28 | ualds_log(UALDS_LOG_NOTICE, "Received signal %d. Terminating now.", sig); 29 | ualds_shutdown(); 30 | } 31 | 32 | /** Starts the windows service and returns. */ 33 | int daemonize() 34 | { 35 | daemon(0, 0); 36 | return ualds_server(); 37 | } 38 | 39 | /** just runs the application without daemonizing. */ 40 | int run() 41 | { 42 | signal(SIGINT, signal_handler); 43 | return ualds_server(); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /linux/daemon.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __DAEMON_H__ 18 | #define __DAEMON_H__ 19 | 20 | int daemonize(); 21 | int run(); 22 | 23 | #endif /* __DAEMON_H__ */ 24 | -------------------------------------------------------------------------------- /linux/log.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __LOG_H__ 18 | #define __LOG_H__ 19 | 20 | enum _LogTarget 21 | { 22 | UALDS_LOG_SYSLOG = 0, /**< uses system log for logging */ 23 | UALDS_LOG_STDERR, /**< prints log messages to stderr (Makes only sense with -d option) */ 24 | UALDS_LOG_FILE /**< logs into a custom file */ 25 | }; 26 | typedef enum _LogTarget LogTarget; 27 | 28 | enum _LogLevel 29 | { 30 | UALDS_LOG_EMERG = 0, /**< system is unusable */ 31 | UALDS_LOG_ALERT, /**< action must be taken immediately */ 32 | UALDS_LOG_CRIT, /**< critical conditions */ 33 | UALDS_LOG_ERR, /**< error conditions */ 34 | UALDS_LOG_WARNING, /**< warnings conditions */ 35 | UALDS_LOG_NOTICE, /**< normal, but significant, condition */ 36 | UALDS_LOG_INFO, /**< informational message */ 37 | UALDS_LOG_DEBUG /** debug-level message */ 38 | }; 39 | typedef enum _LogLevel LogLevel; 40 | 41 | int ualds_openlog(LogTarget target, LogLevel level); 42 | void ualds_log(LogLevel level, const char *format, ...); 43 | void ualds_closelog(); 44 | 45 | #endif /* __LOG_H__ */ 46 | -------------------------------------------------------------------------------- /mdns/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # Cmake project settings 3 | # 4 | cmake_minimum_required(VERSION 2.8.11) 5 | 6 | set(source_c_files 7 | DebugServices.c 8 | dnssd_clientlib.c 9 | dnssd_clientstub.c 10 | dnssd_ipc.c 11 | GenLinkedList.c 12 | ) 13 | if(WIN32) 14 | set(shared_c_files 15 | dllmain.c 16 | dnssd.def 17 | dnssd.rc 18 | ) 19 | 20 | add_definitions( 21 | -D_WINDOWS=1 22 | -D_WINSOCK_DEPRECATED_NO_WARNINGS=1 23 | -DMDNS_DEBUGMSGS=0 24 | -DWIN32_LEAN_AND_MEAN=1 25 | -DNOT_HAVE_SA_LEN=1 26 | -DUSE_TCP_LOOPBACK=1 27 | -D_CRT_SECURE_NO_DEPRECATE=1 28 | -D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 29 | ) 30 | endif() 31 | add_library(dnssd SHARED ${source_c_files} ${shared_c_files}) 32 | set_property(TARGET dnssd PROPERTY POSITION_INDEPENDENT_CODE ON) 33 | target_include_directories(dnssd PUBLIC .) 34 | if(WIN32) 35 | target_link_libraries(dnssd 36 | PRIVATE ws2_32 37 | PRIVATE iphlpapi 38 | PRIVATE secur32 39 | PRIVATE crypt32 40 | ) 41 | endif() 42 | 43 | add_library(dnssd-static STATIC ${source_c_files}) 44 | set_property(TARGET dnssd-static PROPERTY POSITION_INDEPENDENT_CODE ON) 45 | target_include_directories(dnssd-static PUBLIC .) 46 | -------------------------------------------------------------------------------- /mdns/GenLinkedList.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 4 -*- 2 | * 3 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef __GenLinkedList__ 19 | #define __GenLinkedList__ 20 | 21 | 22 | #include 23 | 24 | 25 | struct GenLinkedList 26 | { 27 | void *Head, 28 | *Tail; 29 | size_t LinkOffset; 30 | }; 31 | typedef struct GenLinkedList GenLinkedList; 32 | 33 | 34 | void InitLinkedList( GenLinkedList *pList, size_t linkOffset); 35 | 36 | void AddToHead( GenLinkedList *pList, void *elem); 37 | void AddToTail( GenLinkedList *pList, void *elem); 38 | 39 | int RemoveFromList( GenLinkedList *pList, void *elem); 40 | 41 | int ReplaceElem( GenLinkedList *pList, void *elemInList, void *newElem); 42 | 43 | 44 | 45 | struct GenDoubleLinkedList 46 | { 47 | void *Head, 48 | *Tail; 49 | size_t FwdLinkOffset, 50 | BackLinkOffset; 51 | }; 52 | typedef struct GenDoubleLinkedList GenDoubleLinkedList; 53 | 54 | 55 | void InitDoubleLinkedList( GenDoubleLinkedList *pList, size_t fwdLinkOffset, 56 | size_t backLinkOffset); 57 | 58 | void DLLAddToHead( GenDoubleLinkedList *pList, void *elem); 59 | 60 | void DLLRemoveFromList( GenDoubleLinkedList *pList, void *elem); 61 | 62 | 63 | 64 | /* A GenLinkedOffsetList is like a GenLinkedList that stores the *Next field as a signed */ 65 | /* offset from the address of the beginning of the element, rather than as a pointer. */ 66 | 67 | struct GenLinkedOffsetList 68 | { 69 | size_t Head, 70 | Tail; 71 | size_t LinkOffset; 72 | }; 73 | typedef struct GenLinkedOffsetList GenLinkedOffsetList; 74 | 75 | 76 | void InitLinkedOffsetList( GenLinkedOffsetList *pList, size_t linkOffset); 77 | 78 | void *GetHeadPtr( GenLinkedOffsetList *pList); 79 | void *GetTailPtr( GenLinkedOffsetList *pList); 80 | void *GetOffsetLink( GenLinkedOffsetList *pList, void *elem); 81 | 82 | void OffsetAddToHead( GenLinkedOffsetList *pList, void *elem); 83 | void OffsetAddToTail( GenLinkedOffsetList *pList, void *elem); 84 | 85 | int OffsetRemoveFromList( GenLinkedOffsetList *pList, void *elem); 86 | 87 | int OffsetReplaceElem( GenLinkedOffsetList *pList, void *elemInList, void *newElem); 88 | 89 | 90 | #endif // __GenLinkedList__ 91 | -------------------------------------------------------------------------------- /mdns/WinVersRes.h: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 4 -*- 2 | * 3 | * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef WINRESVERS_H 19 | #define WINRESVERS_H 20 | 21 | #define MASTER_PROD_NAME "Bonjour" 22 | 23 | // Define the company name for mDNSResponder on Windows 24 | #define MASTER_COMPANY_NAME "Apple Inc." 25 | 26 | // Define the product version for mDNSResponder on Windows 27 | #define MASTER_PROD_VERS 3,0,0,2 28 | #define MASTER_PROD_VERS_STR "3,0,0,2" 29 | #define MASTER_PROD_VERS_STR2 "3.0.0.2" 30 | #define MASTER_PROD_VERS_STR3 "Explorer Plugin 3.0.0.2" 31 | 32 | // Define the legal copyright 33 | #define MASTER_LEGAL_COPYRIGHT "Copyright (C) 2003-2011 Apple Inc." 34 | 35 | // Library name 36 | #ifdef NDEBUG 37 | # define LIBRARY_NAME "dnssd.dll" 38 | #else 39 | # define LIBRARY_NAME "dnssdd.dll" 40 | #endif 41 | 42 | #endif // WINRESVERS_H 43 | -------------------------------------------------------------------------------- /mdns/dll.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | #include "WinVersRes.h" 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE 31 | BEGIN 32 | "resource.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "#include ""WinVersRes.h""\0" 39 | END 40 | 41 | 3 TEXTINCLUDE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | 50 | ///////////////////////////////////////////////////////////////////////////// 51 | // 52 | // Version 53 | // 54 | 55 | VS_VERSION_INFO VERSIONINFO 56 | FILEVERSION MASTER_PROD_VERS 57 | PRODUCTVERSION MASTER_PROD_VERS 58 | FILEFLAGSMASK 0x17L 59 | #ifdef _DEBUG 60 | FILEFLAGS 0x1L 61 | #else 62 | FILEFLAGS 0x0L 63 | #endif 64 | FILEOS 0x4L 65 | FILETYPE 0x2L 66 | FILESUBTYPE 0x0L 67 | BEGIN 68 | BLOCK "StringFileInfo" 69 | BEGIN 70 | BLOCK "040904b0" 71 | BEGIN 72 | VALUE "CompanyName", MASTER_COMPANY_NAME 73 | VALUE "FileDescription", "Bonjour Client Library" 74 | VALUE "FileVersion", MASTER_PROD_VERS_STR 75 | VALUE "InternalName", LIBRARY_NAME 76 | VALUE "LegalCopyright", MASTER_LEGAL_COPYRIGHT 77 | VALUE "OriginalFilename", LIBRARY_NAME 78 | VALUE "ProductName", MASTER_PROD_NAME 79 | VALUE "ProductVersion", MASTER_PROD_VERS_STR 80 | END 81 | END 82 | BLOCK "VarFileInfo" 83 | BEGIN 84 | VALUE "Translation", 0x409, 1200 85 | END 86 | END 87 | 88 | #endif // English (U.S.) resources 89 | ///////////////////////////////////////////////////////////////////////////// 90 | 91 | 92 | 93 | #ifndef APSTUDIO_INVOKED 94 | ///////////////////////////////////////////////////////////////////////////// 95 | // 96 | // Generated from the TEXTINCLUDE 3 resource. 97 | // 98 | 99 | 100 | ///////////////////////////////////////////////////////////////////////////// 101 | #endif // not APSTUDIO_INVOKED 102 | 103 | -------------------------------------------------------------------------------- /mdns/dllmain.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; tab-width: 4 -*- 2 | * 3 | * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | BOOL APIENTRY DllMain( HANDLE inModule, DWORD inReason, LPVOID inReserved ) 23 | { 24 | (void) inModule; 25 | (void) inReserved; 26 | 27 | switch( inReason ) 28 | { 29 | case DLL_PROCESS_ATTACH: 30 | case DLL_THREAD_ATTACH: 31 | case DLL_THREAD_DETACH: 32 | case DLL_PROCESS_DETACH: 33 | break; 34 | } 35 | return( TRUE ); 36 | } 37 | 38 | 39 | BOOL 40 | IsSystemServiceDisabled() 41 | { 42 | ENUM_SERVICE_STATUS * lpService = NULL; 43 | SC_HANDLE sc; 44 | BOOL ret = FALSE; 45 | BOOL ok; 46 | DWORD bytesNeeded = 0; 47 | DWORD srvCount; 48 | DWORD resumeHandle = 0; 49 | DWORD srvType; 50 | DWORD srvState; 51 | DWORD dwBytes = 0; 52 | DWORD i; 53 | OSStatus err; 54 | 55 | sc = OpenSCManager( NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE ); 56 | err = translate_errno( sc, GetLastError(), kUnknownErr ); 57 | require_noerr( err, exit ); 58 | 59 | srvType = SERVICE_WIN32; 60 | srvState = SERVICE_STATE_ALL; 61 | 62 | for ( ;; ) 63 | { 64 | // Call EnumServicesStatus using the handle returned by OpenSCManager 65 | 66 | ok = EnumServicesStatus ( sc, srvType, srvState, lpService, dwBytes, &bytesNeeded, &srvCount, &resumeHandle ); 67 | 68 | if ( ok || ( GetLastError() != ERROR_MORE_DATA ) ) 69 | { 70 | break; 71 | } 72 | 73 | if ( lpService ) 74 | { 75 | free( lpService ); 76 | } 77 | 78 | dwBytes = bytesNeeded; 79 | 80 | lpService = ( ENUM_SERVICE_STATUS* ) malloc( dwBytes ); 81 | require_action( lpService, exit, ret = FALSE ); 82 | } 83 | 84 | err = translate_errno( ok, GetLastError(), kUnknownErr ); 85 | require_noerr( err, exit ); 86 | 87 | for ( i = 0; i < srvCount; i++ ) 88 | { 89 | if ( strcmp( lpService[i].lpServiceName, "Bonjour Service" ) == 0 ) 90 | { 91 | if ( ( lpService[i].ServiceStatus.dwCurrentState == SERVICE_PAUSED ) || ( lpService[i].ServiceStatus.dwCurrentState == SERVICE_STOPPED ) ) 92 | { 93 | ret = TRUE; 94 | } 95 | 96 | break; 97 | } 98 | } 99 | 100 | exit: 101 | 102 | if ( lpService ) 103 | { 104 | free( lpService ); 105 | } 106 | 107 | if ( sc ) 108 | { 109 | CloseServiceHandle ( sc ); 110 | } 111 | 112 | return ret; 113 | } 114 | -------------------------------------------------------------------------------- /mdns/dnssd.def: -------------------------------------------------------------------------------- 1 | ; -*- tab-width: 4 -*- 2 | ; 3 | ; Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved. 4 | ; 5 | ; Licensed under the Apache License, Version 2.0 (the "License"); 6 | ; you may not use this file except in compliance with the License. 7 | ; You may obtain a copy of the License at 8 | ; 9 | ; http://www.apache.org/licenses/LICENSE-2.0 10 | ; 11 | ; Unless required by applicable law or agreed to in writing, software 12 | ; distributed under the License is distributed on an "AS IS" BASIS, 13 | ; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ; See the License for the specific language governing permissions and 15 | ; limitations under the License. 16 | ; 17 | 18 | EXPORTS 19 | DNSServiceRefSockFD 20 | DNSServiceProcessResult 21 | DNSServiceRefDeallocate 22 | DNSServiceEnumerateDomains 23 | DNSServiceRegister 24 | DNSServiceAddRecord 25 | DNSServiceUpdateRecord 26 | DNSServiceRemoveRecord 27 | DNSServiceBrowse 28 | DNSServiceResolve 29 | DNSServiceConstructFullName 30 | DNSServiceCreateConnection 31 | DNSServiceRegisterRecord 32 | DNSServiceQueryRecord 33 | DNSServiceReconfirmRecord 34 | DNSServiceNATPortMappingCreate 35 | DNSServiceGetAddrInfo 36 | DNSServiceGetProperty 37 | TXTRecordCreate 38 | TXTRecordDeallocate 39 | TXTRecordSetValue 40 | TXTRecordRemoveValue 41 | TXTRecordContainsKey 42 | TXTRecordGetCount 43 | TXTRecordGetLength 44 | TXTRecordGetBytesPtr 45 | TXTRecordGetValuePtr 46 | TXTRecordGetItemAtIndex 47 | -------------------------------------------------------------------------------- /mdns/dnssd.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCFoundation/UA-LDS/afca39ae449a7e505ff1295fab23a7df851ca9ae/mdns/dnssd.rc -------------------------------------------------------------------------------- /mdns/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by dll.rc 4 | // 5 | #define IDS_PROJNAME 100 6 | #define IDR_WMDMLOGGER 101 7 | #define IDS_LOG_SEV_INFO 201 8 | #define IDS_LOG_SEV_WARN 202 9 | #define IDS_LOG_SEV_ERROR 203 10 | #define IDS_LOG_DATETIME 204 11 | #define IDS_LOG_SRCNAME 205 12 | #define IDS_DEF_LOGFILE 301 13 | #define IDS_DEF_MAXSIZE 302 14 | #define IDS_DEF_SHRINKTOSIZE 303 15 | #define IDS_DEF_LOGENABLED 304 16 | #define IDS_MUTEX_TIMEOUT 401 17 | 18 | // Next default values for new objects 19 | // 20 | #ifdef APSTUDIO_INVOKED 21 | #ifndef APSTUDIO_READONLY_SYMBOLS 22 | #define _APS_NEXT_RESOURCE_VALUE 201 23 | #define _APS_NEXT_COMMAND_VALUE 32768 24 | #define _APS_NEXT_CONTROL_VALUE 201 25 | #define _APS_NEXT_SYMED_VALUE 101 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /settings.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __SETTINGS_H__ 18 | #define __SETTINGS_H__ 19 | 20 | /* system includes */ 21 | #ifdef HAVE_OPCUA_STACK 22 | #include 23 | #include 24 | #endif 25 | /* local platform includes */ 26 | #include 27 | 28 | int ualds_settings_open(const char *szFilename); 29 | int ualds_settings_flush(); 30 | void ualds_settings_update_config_file(); 31 | int ualds_settings_close(int flush); 32 | int ualds_settings_begingroup(const char *szGroup); 33 | int ualds_settings_endgroup(); 34 | int ualds_settings_readstring(const char *szKey, char *szValue, int len); 35 | int ualds_settings_setReadOnly(int readOnly); 36 | #ifdef HAVE_OPCUA_STACK 37 | int ualds_settings_readuastring(const char *szKey, OpcUa_String *pString); 38 | #endif /* HAVE_OPCUA_STACK */ 39 | int ualds_settings_writestring(const char *szKey, const char *szValue); 40 | int ualds_settings_readint(const char *szKey, int *piVal); 41 | int ualds_settings_writeint(const char *szKey, int iVal); 42 | int ualds_settings_readtime_t(const char *szKey, time_t *pTime); 43 | int ualds_settings_writetime_t(const char *szKey, time_t time); 44 | int ualds_settings_beginreadarray(const char *szArrayKey, int *pNumElements); 45 | int ualds_settings_beginwritearray(const char *szArrayKey, int numElements); 46 | int ualds_settings_setarrayindex(int index); 47 | int ualds_settings_endarray(); 48 | int ualds_settings_addcomment(const char* szComment); 49 | int ualds_settings_addemptyline(); 50 | int ualds_settings_removekey(const char *szKey); 51 | int ualds_settings_removearray(const char *szKey); 52 | int ualds_settings_removegroup(const char *szGroup); 53 | 54 | int split_string(char *pszString, char cSep, const char ***pszStringArray); 55 | int replace_string(char *pszString, int len, const char *pszSearch, const char *pszReplace); 56 | 57 | int ualds_settings_open_from_backup(const char *szFilename); 58 | int ualds_settings_open_from_default(const char *szFilename); 59 | 60 | #ifdef _WIN32 61 | #define __ualds_plat_path_sep "\\" 62 | #else 63 | #define __ualds_plat_path_sep "/" 64 | #endif /* _WIN32 */ 65 | 66 | /** Helper macro for lazy programmers. 67 | * This macro reads a string parameter and stores it in a global string variable. 68 | * It assumes that a global variable like "char g_szPARAM[20]" was defined. 69 | * The advantage is that you don't need to type so much, and the \c len parameter is filled 70 | * automatically with the size of the variable. DON'T use string pointers! Otherwise sizeof() 71 | * will not work. 72 | * If you don't understand this, don't use it. 73 | */ 74 | #define UALDS_SETTINGS_READSTRING(param) ualds_settings_readstring(xstr(param), g_sz##param, sizeof(g_sz##param)) 75 | 76 | 77 | #endif /* __SETTINGS_H__ */ 78 | -------------------------------------------------------------------------------- /stack/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 1996-2021, OPC Foundation. All rights reserved. 2 | # 3 | # The source code in this file is covered under a dual-license scenario: 4 | # - RCL: for OPC Foundation members in good-standing 5 | # - GPL V2: everybody else 6 | # 7 | # RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | # 9 | # GNU General Public License as published by the Free Software Foundation; 10 | # version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | # 12 | # This source code is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | cmake_minimum_required(VERSION 2.8.11) 17 | 18 | project(UA-AnsiC) 19 | include(CMakeToolsHelpers OPTIONAL) 20 | 21 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 22 | 23 | set(_PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "Root" FORCE) 24 | enable_testing() 25 | 26 | # 27 | # output paths 28 | # 29 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") 30 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib") 31 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") 32 | 33 | option(compile_options_C "passes a string to the command line of the C compiler" OFF) 34 | if(NOT "${compile_options_C}" STREQUAL "OFF") 35 | set(CMAKE_C_FLAGS "${compile_options_C} ${CMAKE_C_FLAGS}") 36 | endif() 37 | option(compile_options_CXX "passes a string to the command line of the C++ compiler" OFF) 38 | if(NOT "${compile_options_CXX}" STREQUAL "OFF") 39 | set(CMAKE_CXX_FLAGS "${compile_options_CXX} ${CMAKE_CXX_FLAGS}") 40 | endif() 41 | 42 | add_subdirectory(Stack) -------------------------------------------------------------------------------- /stack/README: -------------------------------------------------------------------------------- 1 | OPC UA-AnsiC-Stack - V1.04 2 | ========================== 3 | 4 | This OPC UA Stack contains limited functionality, exclusively for the Local Discovery Server. It cannot be used to create OPC UA Servers or OPC UA Clients. 5 | 6 | Please refer to the official landing page https://opcfoundation.github.io/ 7 | 8 | Please see the Changelog.txt for the changes in the current version. 9 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_H_ 18 | #define _OpcUa_H_ 19 | 20 | /******************************************************************/ 21 | /* STACK INTERNAL FILE - NOT MEANT TO BE INCLUDED BY APPLICATIONS */ 22 | /******************************************************************/ 23 | 24 | /* Collection of includes needed everywhere or at least very often. */ 25 | /* All other includes MUST be included in the source file! */ 26 | #include /* includes typemapping of primitives */ 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | /* platform interface and referenced stack files */ 37 | #include /* needed for some security related files in p_interface */ 38 | #include /* needed for some security related files in p_interface */ 39 | #include 40 | #include /* standalone file */ 41 | 42 | /* Do not include headers in headers if not absolutely necessary. */ 43 | /* This creates a cascade of includes up to the libraries API level.*/ 44 | 45 | 46 | OPCUA_BEGIN_EXTERN_C 47 | 48 | /* import */ 49 | extern OpcUa_Port_CallTable* OpcUa_ProxyStub_g_PlatformLayerCalltable; 50 | extern OpcUa_ProxyStubConfiguration OpcUa_ProxyStub_g_Configuration; 51 | 52 | OPCUA_END_EXTERN_C 53 | #endif /* _OpcUa_H_ */ 54 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_cryptofactory.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_CryptoFactory_H_ 18 | #define _OpcUa_CryptoFactory_H_ 1 19 | 20 | #define OPCUA_P_CRYPTOFACTORY_CREATECRYPTOPROVIDER OpcUa_ProxyStub_g_PlatformLayerCalltable->CreateCryptoProvider 21 | #define OPCUA_P_CRYPTOFACTORY_DELETECRYPTOPROVIDER OpcUa_ProxyStub_g_PlatformLayerCalltable->DeleteCryptoProvider 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_datetime.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #define OpcUa_P_DateTime_UtcNow OpcUa_ProxyStub_g_PlatformLayerCalltable->UtcNow 21 | #define OpcUa_P_DateTime_GetTimeOfDay OpcUa_ProxyStub_g_PlatformLayerCalltable->GetTimeOfDay 22 | #define OpcUa_P_DateTime_GetDateTimeFromString OpcUa_ProxyStub_g_PlatformLayerCalltable->GetDateTimeFromString 23 | #define OpcUa_P_DateTime_GetStringFromDateTime OpcUa_ProxyStub_g_PlatformLayerCalltable->GetStringFromDateTime 24 | 25 | /*============================================================================*/ 26 | OpcUa_StatusCode OpcUa_DateTime_GetTimeOfDay(OpcUa_TimeVal* a_pValue) 27 | { 28 | OpcUa_DeclareErrorTraceModule(OpcUa_Module_DateTime); 29 | OpcUa_ReturnErrorIfArgumentNull(a_pValue); 30 | 31 | OpcUa_P_DateTime_GetTimeOfDay(a_pValue); 32 | 33 | return OpcUa_Good; 34 | } 35 | 36 | /*============================================================================*/ 37 | OpcUa_StatusCode OpcUa_DateTime_GetDateTimeFromString( OpcUa_StringA a_pchDateTimeString, 38 | OpcUa_DateTime* a_pDateTime) 39 | { 40 | OpcUa_DeclareErrorTraceModule(OpcUa_Module_DateTime); 41 | OpcUa_ReturnErrorIfArgumentNull(a_pchDateTimeString); 42 | OpcUa_ReturnErrorIfArgumentNull(a_pDateTime); 43 | 44 | return OpcUa_P_DateTime_GetDateTimeFromString(a_pchDateTimeString, a_pDateTime); 45 | } 46 | 47 | /*============================================================================*/ 48 | OpcUa_StatusCode OpcUa_DateTime_GetStringFromDateTime( OpcUa_DateTime a_dateTime, 49 | OpcUa_StringA a_pBuffer, 50 | OpcUa_UInt32 a_uLength) 51 | { 52 | OpcUa_DeclareErrorTraceModule(OpcUa_Module_DateTime); 53 | OpcUa_ReturnErrorIfArgumentNull(a_pBuffer); 54 | 55 | if(a_uLength < 25) 56 | { 57 | return OpcUa_BadInvalidArgument; 58 | } 59 | 60 | return OpcUa_P_DateTime_GetStringFromDateTime(a_dateTime, a_pBuffer, a_uLength); 61 | } 62 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_datetime.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_DateTime_H_ 18 | #define _OpcUa_DateTime_H_ 1 19 | 20 | OPCUA_BEGIN_EXTERN_C 21 | 22 | /*============================================================================ 23 | * Functions for OpcUa_DateTime 24 | *===========================================================================*/ 25 | 26 | /** 27 | @brief Returns the UTC time in OpcUa_DateTime format. 28 | 29 | @return the UTC time 30 | */ 31 | #define OPCUA_P_DATETIME_UTCNOW OpcUa_ProxyStub_g_PlatformLayerCalltable->UtcNow 32 | 33 | /** 34 | @brief Convert a string to a date-time 35 | 36 | @return OpcUa_BadInvalidArgument if a_pchDateTimeString is null 37 | @return OpcUa_BadInvalidArgument if the string is incorrectly formatted 38 | @return OpcUa_Bad for other failures 39 | @return OpcUa_Good on success 40 | 41 | @param szDateTimeString [in] String to convert 42 | @param pDateTime [out] Location to store the date-time 43 | */ 44 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_DateTime_GetDateTimeFromString( OpcUa_CharA* szDateTimeString, 45 | OpcUa_DateTime* pDateTime); 46 | 47 | /** 48 | @brief Convert a date-time to a string 49 | 50 | @return OpcUa_BadInvalidArgument if buffer is null 51 | @return OpcUa_BadInvalidArgument if the buffer is too short 52 | @return OpcUa_Good on success 53 | 54 | @param DateTime [in] Date-time to convert. 55 | @param pchBuffer [bi] Byte buffer to store the result (at last 25 bytes long). 56 | @param uLength [in] Length of the given buffer in bytes (at least 25). 57 | */ 58 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_DateTime_GetStringFromDateTime( OpcUa_DateTime DateTime, 59 | OpcUa_CharA* pchBuffer, 60 | OpcUa_UInt32 uLength); 61 | 62 | /*============================================================================ 63 | * Functions for OpcUa_TimeVal 64 | *===========================================================================*/ 65 | 66 | 67 | /** 68 | @brief Get the time in OpcUa_TimeVal format 69 | 70 | @return OpcUa_BadInvalidArgument if pValue is null 71 | @return OpcUa_Good on success 72 | 73 | @param pValue [out] Location of an OpcUa_TimeVal to store the time of day 74 | */ 75 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_DateTime_GetTimeOfDay(OpcUa_TimeVal* pValue); 76 | 77 | 78 | OPCUA_END_EXTERN_C 79 | 80 | #endif /* _OpcUa_DateTime_H_ */ 81 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_guid.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_Guid_H_ 18 | #define _OpcUa_Guid_H_ 1 19 | 20 | OPCUA_BEGIN_EXTERN_C 21 | 22 | /*============================================================================ 23 | * Defines 24 | *===========================================================================*/ 25 | 26 | #define OPCUA_GUID_LEXICAL_LENGTH 38 /* length of the lexical representation without trailing limiter! */ 27 | 28 | /*============================================================================ 29 | * Types 30 | *===========================================================================*/ 31 | 32 | /** 33 | @brief An empty GUID. 34 | */ 35 | OPCUA_IMEXPORT extern OpcUa_Guid OpcUa_Guid_Null; 36 | 37 | /** 38 | @brief Creates a new GUID. 39 | 40 | @param pGuid [bi] The buffer to store the new GUID in. 41 | */ 42 | OPCUA_EXPORT OpcUa_Guid* OpcUa_Guid_Create(OpcUa_Guid* pGuid); 43 | 44 | /** 45 | @brief Converts a UTF-8 string representation of a GUID to a binary representation. 46 | 47 | @param szText [in] The string representation. 48 | @param pGuid [out] The binary representation. 49 | */ 50 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_Guid_FromString( 51 | OpcUa_CharA* szText, 52 | OpcUa_Guid* pGuid); 53 | 54 | /** 55 | @brief Converts a binary representation of a GUID to a UTF-8 representation. 56 | 57 | @param pGuid [in] The binary representation. 58 | @param szText [bi] The string representation. 59 | */ 60 | OPCUA_EXPORT OpcUa_CharA* OpcUa_Guid_ToStringA( 61 | OpcUa_Guid* pGuid, 62 | OpcUa_CharA* szText); 63 | 64 | /** 65 | @brief Converts a binary representation of a GUID to a newly created OpcUa_String. 66 | 67 | @param pGuid [in] The binary representation. 68 | @param pszText [out] The string representation. 69 | */ 70 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_Guid_ToString( 71 | OpcUa_Guid* pGuid, 72 | OpcUa_String** pszText); 73 | 74 | /** 75 | @brief Returns true if the two guids are equal. 76 | 77 | @param pGuid1 [in] The first guid to compare. 78 | @param pGuid2 [in] The second guid to compare. 79 | */ 80 | OPCUA_EXPORT OpcUa_Boolean OpcUa_Guid_IsEqual( 81 | OpcUa_Guid* pGuid1, 82 | OpcUa_Guid* pGuid2); 83 | 84 | /** 85 | @brief Returns true if the guid is a null guid. 86 | 87 | @param pGuid [in] The guid to test. 88 | */ 89 | OPCUA_EXPORT OpcUa_Boolean OpcUa_Guid_IsNull(OpcUa_Guid* pGuid); 90 | 91 | /** 92 | @brief Copies a guid. 93 | 94 | @param pDstGuid [bi] The guid to change. 95 | @param pSrcGuid [in] The guid to copy. 96 | */ 97 | OPCUA_EXPORT OpcUa_Void OpcUa_Guid_Copy( 98 | OpcUa_Guid* pDstGuid, 99 | OpcUa_Guid* pSrcGuid); 100 | 101 | 102 | OPCUA_END_EXTERN_C 103 | 104 | #endif /* _OpcUa_Guid_H_ */ 105 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_memory.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | 18 | #ifndef _OpcUa_Memory_H_ 19 | #define _OpcUa_Memory_H_ 1 20 | 21 | OPCUA_BEGIN_EXTERN_C 22 | 23 | /** 24 | * @brief Allocates a new block of memory. 25 | * 26 | * @param nSize [in] The size of the block to allocate. 27 | */ 28 | OPCUA_EXPORT OpcUa_Void* OPCUA_DLLCALL OpcUa_Memory_Alloc(OpcUa_UInt32 nSize); 29 | 30 | /** 31 | * @brief Reallocates a block of memory 32 | * 33 | * @param pBuffer [in] The existing memory block. 34 | * @param nSize [in] The size of the block to allocate. 35 | */ 36 | OPCUA_EXPORT OpcUa_Void* OPCUA_DLLCALL OpcUa_Memory_ReAlloc(OpcUa_Void* pBuffer, 37 | OpcUa_UInt32 nSize); 38 | 39 | /** 40 | * @brief Frees a block of memory. 41 | * 42 | * @param pvBuffer [in] The existing memory block. 43 | */ 44 | OPCUA_EXPORT OpcUa_Void OPCUA_DLLCALL OpcUa_Memory_Free(OpcUa_Void* pvBuffer); 45 | 46 | /** 47 | * @brief Copies a block of memory. 48 | * 49 | * @param pBuffer [in] The destination memory block. 50 | * @param nSizeInBytes [in] The size of the destination memory block. 51 | * @param pSource [in] The memory block being copied. 52 | * @param nCount [in] The number of bytes to copy. 53 | * 54 | * @return StatusCode: 55 | * OpcUa_BadInvalidArgument if Buffer or Source equals OpcUa_Null; 56 | * OpcUa_BadOutOfRange if number of bytes to copy greater nSizeInBytes 57 | */ 58 | OPCUA_EXPORT OpcUa_StatusCode OPCUA_DLLCALL OpcUa_Memory_MemCpy( OpcUa_Void* pBuffer, 59 | OpcUa_UInt32 nSizeInBytes, 60 | OpcUa_Void* pSource, 61 | OpcUa_UInt32 nCount); 62 | 63 | /** 64 | * @brief destroys secret data values in a cyptographically safe way. 65 | * Does not necessarily set the memory to zero. 66 | * Does nothing unless security is enabled. 67 | * 68 | * @param pData [in] The memory block to be erased. 69 | * @param nBytes [in] The number of bytes to erase. 70 | */ 71 | OPCUA_EXPORT OpcUa_Void OPCUA_DLLCALL OpcUa_Memory_DestroySecretData(OpcUa_Void* pData, 72 | OpcUa_UInt32 nBytes); 73 | 74 | OPCUA_END_EXTERN_C 75 | 76 | #endif /* _OpcUa_Memory_H_ */ 77 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_mutex.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #if OPCUA_MUTEX_ERROR_CHECKING 18 | #define OPCUA_P_MUTEX_CREATE(xMutex) OpcUa_ProxyStub_g_PlatformLayerCalltable->MutexCreate( xMutex, __FILE__, __LINE__) 19 | #define OPCUA_P_MUTEX_DELETE(xMutex) OpcUa_ProxyStub_g_PlatformLayerCalltable->MutexDelete( xMutex, __FILE__, __LINE__) 20 | #define OPCUA_P_MUTEX_LOCK(xMutex) OpcUa_ProxyStub_g_PlatformLayerCalltable->MutexLock( xMutex, __FILE__, __LINE__) 21 | #define OPCUA_P_MUTEX_UNLOCK(xMutex) OpcUa_ProxyStub_g_PlatformLayerCalltable->MutexUnlock( xMutex, __FILE__, __LINE__) 22 | #else /* OPCUA_MUTEX_ERROR_CHECKING */ 23 | #if OPCUA_USE_SYNCHRONISATION 24 | #define OPCUA_P_MUTEX_CREATE OpcUa_ProxyStub_g_PlatformLayerCalltable->MutexCreate 25 | #define OPCUA_P_MUTEX_DELETE OpcUa_ProxyStub_g_PlatformLayerCalltable->MutexDelete 26 | #define OPCUA_P_MUTEX_LOCK OpcUa_ProxyStub_g_PlatformLayerCalltable->MutexLock 27 | #define OPCUA_P_MUTEX_UNLOCK OpcUa_ProxyStub_g_PlatformLayerCalltable->MutexUnlock 28 | #else /* OPCUA_USE_SYNCHRONISATION */ 29 | #define OPCUA_P_MUTEX_CREATE(xMutex) OpcUa_Good 30 | #define OPCUA_P_MUTEX_DELETE(xMutex) 31 | #define OPCUA_P_MUTEX_LOCK(xMutex) 32 | #define OPCUA_P_MUTEX_UNLOCK(xMutex) 33 | #endif /* OPCUA_USE_SYNCHRONISATION */ 34 | #endif /* OPCUA_MUTEX_ERROR_CHECKING */ 35 | 36 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_pkifactory.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_PKIFactory_H_ 18 | #define _OpcUa_PKIFactory_H_ 1 19 | 20 | OPCUA_BEGIN_EXTERN_C 21 | 22 | #define OPCUA_P_PKIFACTORY_CREATEPKIPROVIDER OpcUa_ProxyStub_g_PlatformLayerCalltable->CreatePKIProvider 23 | #define OPCUA_P_PKIFACTORY_DELETEPKIPROVIDER OpcUa_ProxyStub_g_PlatformLayerCalltable->DeletePKIProvider 24 | 25 | OPCUA_END_EXTERN_C 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_semaphore.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #if OPCUA_USE_SYNCHRONISATION 18 | # define OPCUA_P_SEMAPHORE_CREATE OpcUa_ProxyStub_g_PlatformLayerCalltable->SemaphoreCreate 19 | # define OPCUA_P_SEMAPHORE_DELETE OpcUa_ProxyStub_g_PlatformLayerCalltable->SemaphoreDelete 20 | # define OPCUA_P_SEMAPHORE_WAIT OpcUa_ProxyStub_g_PlatformLayerCalltable->SemaphoreWait 21 | # define OPCUA_P_SEMAPHORE_TIMEDWAIT OpcUa_ProxyStub_g_PlatformLayerCalltable->SemaphoreTimedWait 22 | # define OPCUA_P_SEMAPHORE_POST OpcUa_ProxyStub_g_PlatformLayerCalltable->SemaphorePost 23 | #else /* OPCUA_USE_SYNCHRONISATION */ 24 | # define OPCUA_P_SEMAPHORE_CREATE(a, b, c) OpcUa_Good 25 | # define OPCUA_P_SEMAPHORE_DELETE(a) 26 | # define OPCUA_P_SEMAPHORE_WAIT(a) OpcUa_Good 27 | # define OPCUA_P_SEMAPHORE_TIMEDWAIT(a, b) OpcUa_Good 28 | # define OPCUA_P_SEMAPHORE_POST(a, b) OpcUa_Good 29 | #endif /* OPCUA_USE_SYNCHRONISATION */ 30 | 31 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_socket.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_Socket_H_ 18 | #define _OpcUa_Socket_H_ 1 19 | 20 | OPCUA_BEGIN_EXTERN_C 21 | 22 | #define OPCUA_P_SOCKETMANAGER_CREATE OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketManagerCreate 23 | #define OPCUA_P_SOCKETMANAGER_DELETE OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketManagerDelete 24 | #define OPCUA_P_SOCKETMANAGER_CREATESERVER OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketManagerCreateServer 25 | #define OPCUA_P_SOCKETMANAGER_CREATECLIENT OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketManagerCreateClient 26 | #define OPCUA_P_SOCKETMANAGER_CREATESSLSERVER OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketManagerCreateSslServer 27 | #define OPCUA_P_SOCKETMANAGER_CREATESSLCLIENT OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketManagerCreateSslClient 28 | #define OPCUA_P_SOCKETMANAGER_SIGNALEVENT OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketManagerSignalEvent 29 | #define OPCUA_P_SOCKETMANAGER_SERVELOOP OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketManagerServeLoop 30 | #define OPCUA_P_SOCKETUDP_CREATESENDER OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketUdpCreateSender 31 | #define OPCUA_P_SOCKETUDP_CREATERECEIVER OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketUdpCreateReceiver 32 | 33 | #define OPCUA_P_SOCKET_READ OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketRead 34 | #define OPCUA_P_SOCKET_WRITE OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketWrite 35 | #define OPCUA_P_SOCKET_CLOSE OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketClose 36 | #define OPCUA_P_SOCKET_GETPEERINFO OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketGetPeerInfo 37 | #define OPCUA_P_SOCKET_CHANGEEVENTLIST /* Todo */ 38 | #define OPCUA_P_SOCKET_GETLASTERROR OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketGetLastError 39 | #define OPCUA_P_SOCKET_SETUSERDATA OpcUa_ProxyStub_g_PlatformLayerCalltable->SocketSetUserData 40 | 41 | #define OPCUA_P_INITIALIZENETWORK OpcUa_ProxyStub_g_PlatformLayerCalltable->NetworkInitialize 42 | #define OPCUA_P_CLEANUPNETWORK OpcUa_ProxyStub_g_PlatformLayerCalltable->NetworkCleanup 43 | 44 | OPCUA_END_EXTERN_C 45 | 46 | #endif /* _OpcUa_Socket_H_ */ 47 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_timer.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | /*============================================================================ 24 | * Delete A Timer 25 | *===========================================================================*/ 26 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_Timer_Delete(OpcUa_Timer* a_phTimer) 27 | { 28 | return OPCUA_P_TIMER_DELETE(a_phTimer); 29 | } 30 | 31 | 32 | /*============================================================================ 33 | * Create A Timer 34 | *===========================================================================*/ 35 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_Timer_Create( OpcUa_Timer* a_phTimer, 36 | OpcUa_UInt32 a_msecInterval, 37 | OpcUa_Timer_Callback* a_fpTimerCallback, 38 | OpcUa_Timer_Callback* a_fpKillCallback, 39 | OpcUa_Void* a_pvCallbackData) 40 | { 41 | return OPCUA_P_TIMER_CREATE( a_phTimer, 42 | a_msecInterval, 43 | a_fpTimerCallback, 44 | a_fpKillCallback, 45 | a_pvCallbackData); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_timer.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_Timer_H_ 18 | #define _OpcUa_Timer_H_ 1 19 | 20 | OPCUA_BEGIN_EXTERN_C 21 | 22 | #define OPCUA_P_TIMER_CREATE OpcUa_ProxyStub_g_PlatformLayerCalltable->TimerCreate 23 | #define OPCUA_P_TIMER_DELETE OpcUa_ProxyStub_g_PlatformLayerCalltable->TimerDelete 24 | #define OPCUA_P_CLEANUPTIMERS OpcUa_ProxyStub_g_PlatformLayerCalltable->TimersCleanup 25 | 26 | typedef OpcUa_StatusCode (OPCUA_DLLCALL OpcUa_Timer_Callback)( OpcUa_Void* pvCallbackData, 27 | OpcUa_Timer hTimer, 28 | OpcUa_UInt32 msecElapsed); 29 | 30 | OPCUA_EXPORT OpcUa_StatusCode OPCUA_DLLCALL OpcUa_Timer_Create( OpcUa_Timer* hTimer, 31 | OpcUa_UInt32 msecInterval, 32 | OpcUa_Timer_Callback* fpTimerCallback, 33 | OpcUa_Timer_Callback* fpKillCallback, 34 | OpcUa_Void* pvCallbackData); 35 | 36 | OPCUA_EXPORT OpcUa_StatusCode OPCUA_DLLCALL OpcUa_Timer_Delete( OpcUa_Timer* phTimer); 37 | 38 | OPCUA_END_EXTERN_C 39 | 40 | #endif /*_OpcUa_Timer_H_ */ 41 | -------------------------------------------------------------------------------- /stack/Stack/core/opcua_utilities.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_Utilities_H_ 18 | #define _OpcUa_Utilities_H_ 1 19 | 20 | #include 21 | 22 | OPCUA_BEGIN_EXTERN_C 23 | 24 | enum _OpcUa_ProtocolType 25 | { 26 | OpcUa_ProtocolType_Invalid, 27 | OpcUa_ProtocolType_Http, 28 | OpcUa_ProtocolType_Tcp 29 | }; 30 | typedef enum _OpcUa_ProtocolType OpcUa_ProtocolType; 31 | 32 | 33 | /** 34 | * @brief Sorts an array. 35 | * 36 | * @param pElements [in] The array of elements to sort. 37 | * @param nElementCount [in] The number of elements in the array. 38 | * @param nElementSize [in] The size a single element in the array. 39 | * @param pfnCompare [in] The function used to compare elements. 40 | * @param pContext [in] A context that is passed to the compare function. 41 | */ 42 | OPCUA_EXPORT 43 | OpcUa_StatusCode OpcUa_QSort( OpcUa_Void* pElements, 44 | OpcUa_UInt32 nElementCount, 45 | OpcUa_UInt32 nElementSize, 46 | OpcUa_PfnCompare* pfnCompare, 47 | OpcUa_Void* pContext); 48 | 49 | /** 50 | * @brief Searches a sorted array. 51 | * 52 | * @param pKey [in] The element to find. 53 | * @param pElements [in] The array of elements to sort. 54 | * @param nElementCount [in] The number of elements in the array. 55 | * @param nElementSize [in] The size a single element in the array. 56 | * @param pfnCompare [in] The function used to compare elements. 57 | * @param pContext [in] A context that is passed to the compare function. 58 | */ 59 | OPCUA_EXPORT 60 | OpcUa_Void* OpcUa_BSearch( OpcUa_Void* pKey, 61 | OpcUa_Void* pElements, 62 | OpcUa_UInt32 nElementCount, 63 | OpcUa_UInt32 nElementSize, 64 | OpcUa_PfnCompare* pfnCompare, 65 | OpcUa_Void* pContext); 66 | 67 | /** 68 | * @brief Returns the CRT errno constant. 69 | */ 70 | OPCUA_EXPORT 71 | OpcUa_UInt32 OpcUa_GetLastError(void); 72 | 73 | /** 74 | * @brief Returns the number of milliseconds since the system or process was started. 75 | */ 76 | OPCUA_EXPORT 77 | OpcUa_UInt32 OpcUa_GetTickCount(void); 78 | 79 | /** 80 | * @brief Convert string to integer. 81 | */ 82 | #define OpcUa_CharAToInt(xChar) OpcUa_ProxyStub_g_PlatformLayerCalltable->CharToInt(xChar) 83 | 84 | OPCUA_END_EXTERN_C 85 | 86 | #endif /* _OpcUa_Utilities_H_ */ 87 | -------------------------------------------------------------------------------- /stack/Stack/linux_gcc.mak: -------------------------------------------------------------------------------- 1 | # Copyright (c) 1996-2021, OPC Foundation. All rights reserved. 2 | # 3 | # The source code in this file is covered under a dual-license scenario: 4 | # - RCL: for OPC Foundation members in good-standing 5 | # - GPL V2: everybody else 6 | # 7 | # RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | # 9 | # GNU General Public License as published by the Free Software Foundation; 10 | # version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | # 12 | # This source code is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | ROOT = .. 17 | 18 | include $(ROOT)/linux_gcc_rules.mak 19 | 20 | TARGET = $(ROOT)/lib/$(BIN_PATH)/$(CC)/$(BUILD_TARGET)/libuastack.a 21 | 22 | DIRS = core stackcore securechannel transport/tcp transport/https \ 23 | proxystub/serverstub platforms/linux 24 | 25 | CFLAGS = -Wall -Wextra -Wshadow -Wundef -Wmissing-prototypes -Wstrict-prototypes -pthread \ 26 | $(patsubst %,-I%,$(DIRS)) $(EXTRA_CFLAGS) 27 | 28 | SOURCES = $(wildcard $(patsubst %,%/*.c,$(DIRS))) 29 | 30 | OBJECTS = $(SOURCES:%.c=./$(BIN_PATH)/$(CC)/$(BUILD_TARGET)/%.o) 31 | 32 | DEPS = $(OBJECTS:%.o=%.d) 33 | 34 | all: $(TARGET) 35 | 36 | ifneq ($(MAKECMDGOALS),clean) 37 | -include $(DEPS) 38 | $(OBJECTS): linux_gcc.mak $(ROOT)/linux_gcc_rules.mak 39 | endif 40 | 41 | strip: 42 | $(STRIP) -g $(TARGET) 43 | 44 | clean: 45 | $(RM) $(OBJECTS) 46 | $(RM) $(DEPS) 47 | $(RM) $(TARGET) 48 | 49 | $(TARGET): $(OBJECTS) 50 | $(MKDIR) $(dir $@) 51 | $(AR) rcs $@ $^ 52 | 53 | ./$(BIN_PATH)/$(CC)/$(BUILD_TARGET)/%.o : %.c 54 | $(MKDIR) $(dir $@) 55 | $(CC) -c $(CFLAGS) -MMD -MP -MT $@ -MF $(@:%.o=%.d) -o $@ $< 56 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_cryptofactory.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #ifndef _OpcUa_P_CryptoFactory_H_ 31 | #define _OpcUa_P_CryptoFactory_H_ 1 32 | 33 | OPCUA_BEGIN_EXTERN_C 34 | 35 | /** 36 | @brief OpcUa_CryptoFactory_CreateCryptoProvider. 37 | 38 | @param securityPolicy [in] The security policy. 39 | @param pProvider [out] The resulting CryptoProvider. 40 | */ 41 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_CryptoFactory_CreateCryptoProvider( OpcUa_StringA Uri, 42 | OpcUa_CryptoProvider* pProvider); 43 | 44 | /** 45 | @brief OpcUa_CryptoFactory_DeleteCryptoProvider. 46 | 47 | @param pProvider [out] The resulting CryptoProvider. 48 | */ 49 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_CryptoFactory_DeleteCryptoProvider( OpcUa_CryptoProvider* pProvider); 50 | 51 | OPCUA_END_EXTERN_C 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_datetime.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | /** 31 | * @brief Returns the current time in UTC. 32 | */ 33 | OpcUa_DateTime OpcUa_P_DateTime_UtcNow(void); 34 | 35 | /** 36 | * @brief Returns the time in OpcUa_TimeVal format. 37 | */ 38 | OpcUa_Void OpcUa_P_DateTime_GetTimeOfDay(OpcUa_TimeVal* pValue); 39 | 40 | /** 41 | * @brief Converts the given OpcUa_DateTime into an ascii string. 42 | * 43 | * @param DateTime [in] The DateTime value to convert. 44 | * @param Buffer [in/out] At least 20+1 bytes of buffer. 45 | * @param DateTime [in] The length of the given buffer. 46 | * 47 | * @return Error Code 48 | */ 49 | OpcUa_StatusCode OpcUa_P_DateTime_GetStringFromDateTime(OpcUa_DateTime datetime, 50 | OpcUa_StringA buffer, 51 | OpcUa_UInt32 length); 52 | 53 | 54 | /** 55 | * @brief Converts the given (ascii) string into OpcUa_DateTime format. 56 | * 57 | * @param DateTimeString [in] Buffer containing the DateTime string. Must not be OpcUa_Null! 58 | * @param DateTime [out] Pointer to the OpcUa_DateTime value in which the converted value will be stored. 59 | * 60 | * @return Status Code. 61 | */ 62 | OpcUa_StatusCode OpcUa_P_DateTime_GetDateTimeFromString( OpcUa_StringA DateTimeString, 63 | OpcUa_DateTime* DateTime); 64 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_guid.c: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #include 31 | #include 32 | 33 | /* UA platform definitions */ 34 | #include 35 | 36 | #if OPCUA_REQUIRE_OPENSSL 37 | #include 38 | #endif 39 | 40 | /* own headers */ 41 | #include 42 | #include 43 | /*============================================================================ 44 | * CreateGuid 45 | *===========================================================================*/ 46 | /** 47 | * CreateGuid generates a global unique identifier. 48 | */ 49 | OpcUa_Guid* OpcUa_P_Guid_Create(OpcUa_Guid* guid) 50 | { 51 | #if OPCUA_REQUIRE_OPENSSL 52 | if(RAND_bytes((unsigned char*)guid, sizeof(OpcUa_Guid)) <= 0) 53 | { 54 | return OpcUa_Null; 55 | } 56 | #else 57 | unsigned int *data = (unsigned int*)guid; 58 | int chunks = 16 / sizeof(unsigned int); 59 | static const int intbits = sizeof(int)*8; 60 | static int randbits = 0; 61 | if(!randbits) 62 | { 63 | int max = RAND_MAX; 64 | do { ++randbits; } while ((max=max>>1)); 65 | srand(time(NULL)); 66 | rand(); /* Skip first */ 67 | } 68 | 69 | while(chunks--) 70 | { 71 | unsigned int randNumber = 0; 72 | int filled; 73 | for (filled = 0; filled < intbits; filled += randbits) 74 | randNumber |= (unsigned int)rand()<Data4[0] = (guid->Data4[0] & 0x3F) | 0x80; /* UV_DCE */ 80 | guid->Data3 = (guid->Data3 & 0x0FFF) | 0x4000; /* UV_Random */ 81 | 82 | return guid; 83 | } 84 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_guid.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | /*============================================================================ 31 | * CreateGuid 32 | *===========================================================================*/ 33 | /** 34 | * Create a GUID in binary format. 35 | */ 36 | OpcUa_Guid* OPCUA_DLLCALL OpcUa_P_Guid_Create(OpcUa_Guid* Guid); 37 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_memory.c: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #include 31 | #include 32 | #include /* for errornumbers when using save functions */ 33 | 34 | #include 35 | #include 36 | 37 | 38 | /*============================================================================ 39 | * OpcUa_Memory_Alloc 40 | *===========================================================================*/ 41 | OpcUa_Void* OPCUA_DLLCALL OpcUa_P_Memory_Alloc(OpcUa_UInt32 nSize) 42 | { 43 | return malloc(nSize); 44 | } 45 | 46 | /*============================================================================ 47 | * OpcUa_Memory_ReAlloc 48 | *===========================================================================*/ 49 | OpcUa_Void* OPCUA_DLLCALL OpcUa_P_Memory_ReAlloc(OpcUa_Void* pBuffer, OpcUa_UInt32 nSize) 50 | { 51 | return realloc(pBuffer, nSize); 52 | } 53 | 54 | /*============================================================================ 55 | * OpcUa_Memory_Free 56 | *===========================================================================*/ 57 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Memory_Free(OpcUa_Void* pBuffer) 58 | { 59 | free(pBuffer); 60 | } 61 | 62 | /*============================================================================ 63 | * OpcUa_Memory_MemCpy 64 | *===========================================================================*/ 65 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Memory_MemCpy( 66 | OpcUa_Void* pBuffer, 67 | OpcUa_UInt32 nSizeInBytes, 68 | OpcUa_Void* pSource, 69 | OpcUa_UInt32 nCount) 70 | { 71 | if( pBuffer == OpcUa_Null 72 | || pSource == OpcUa_Null) 73 | { 74 | return OpcUa_BadInvalidArgument; 75 | } 76 | 77 | if(nSizeInBytes < nCount) 78 | { 79 | return OpcUa_BadOutOfRange; 80 | } 81 | 82 | if(memcpy(pBuffer, pSource, nCount) != pBuffer) 83 | { 84 | return OpcUa_BadInvalidArgument; 85 | } 86 | 87 | return OpcUa_Good; 88 | } 89 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_memory.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #ifndef _OpcUa_P_Memory_H_ 31 | #define _OpcUa_P_Memory_H_ 1 32 | 33 | #include 34 | 35 | OPCUA_BEGIN_EXTERN_C 36 | 37 | /** 38 | * @see OpcUa_Memory_Alloc 39 | */ 40 | OpcUa_Void* OPCUA_DLLCALL OpcUa_P_Memory_Alloc( OpcUa_UInt32 nSize); 41 | 42 | /** 43 | * @brief Reallocates a new block of memory 44 | * 45 | * @param pBuffer [in] The existing memory block. 46 | * @param nSize [in] The size of the block to allocate. 47 | */ 48 | OpcUa_Void* OPCUA_DLLCALL OpcUa_P_Memory_ReAlloc( OpcUa_Void* pBuffer, 49 | OpcUa_UInt32 nSize); 50 | 51 | /** 52 | * @see OpcUa_Memory_Free 53 | */ 54 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Memory_Free( OpcUa_Void* pvBuffer); 55 | 56 | /** 57 | * @see OpcUa_Memory_MemCpy 58 | */ 59 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Memory_MemCpy( OpcUa_Void* pBuffer, 60 | OpcUa_UInt32 nSizeInBytes, 61 | OpcUa_Void* pSource, 62 | OpcUa_UInt32 nCount); 63 | 64 | OPCUA_END_EXTERN_C 65 | 66 | #endif /* _OpcUa_P_Memory_H_ */ 67 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_mutex.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #if OPCUA_MUTEX_ERROR_CHECKING 31 | #define OpcUa_P_Mutex_Create(xMutex) OpcUa_P_Mutex_CreateImp( xMutex, __FILE__, __LINE__) 32 | #define OpcUa_P_Mutex_Delete(xMutex) OpcUa_P_Mutex_DeleteImp( xMutex, __FILE__, __LINE__) 33 | #define OpcUa_P_Mutex_Lock(xMutex) OpcUa_P_Mutex_LockImp( xMutex, __FILE__, __LINE__) 34 | #define OpcUa_P_Mutex_Unlock(xMutex) OpcUa_P_Mutex_UnlockImp( xMutex, __FILE__, __LINE__) 35 | #else /* OPCUA_MUTEX_ERROR_CHECKING */ 36 | #define OpcUa_P_Mutex_Create(xMutex) OpcUa_P_Mutex_CreateImp( xMutex) 37 | #define OpcUa_P_Mutex_Delete(xMutex) OpcUa_P_Mutex_DeleteImp( xMutex) 38 | #define OpcUa_P_Mutex_Lock(xMutex) OpcUa_P_Mutex_LockImp( xMutex) 39 | #define OpcUa_P_Mutex_Unlock(xMutex) OpcUa_P_Mutex_UnlockImp( xMutex) 40 | #endif /* OPCUA_MUTEX_ERROR_CHECKING */ 41 | 42 | #if OPCUA_MUTEX_ERROR_CHECKING 43 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Mutex_CreateImp( OpcUa_Mutex* phMutex, char* file, int line); 44 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_DeleteImp( OpcUa_Mutex* phMutex, char* file, int line); 45 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_LockImp( OpcUa_Mutex hMutex, char* file, int line); 46 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_UnlockImp( OpcUa_Mutex hMutex, char* file, int line); 47 | #else 48 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Mutex_CreateImp( OpcUa_Mutex* phMutex); 49 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_DeleteImp( OpcUa_Mutex* phMutex); 50 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_LockImp( OpcUa_Mutex hMutex); 51 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_UnlockImp( OpcUa_Mutex hMutex); 52 | #endif 53 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_pkifactory.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #ifndef _OpcUa_P_PKIFactory_H_ 31 | #define _OpcUa_P_PKIFactory_H_ 1 32 | 33 | OPCUA_BEGIN_EXTERN_C 34 | /** 35 | @brief Create the PKI Factory object 36 | */ 37 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_PKIFactory_CreatePKIProvider( OpcUa_Void* pCertificateStoreConfig, 38 | OpcUa_PKIProvider* pProvider); 39 | 40 | /** 41 | @brief Delete the PKI Factory object 42 | */ 43 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_PKIFactory_DeletePKIProvider( OpcUa_PKIProvider* pProvider); 44 | 45 | 46 | /** 47 | @brief Extract DH parameter file name from PKI Config 48 | Return NULL if not available 49 | */ 50 | OpcUa_StringA OpcUa_P_PKIFactory_GetDHParamFileName(OpcUa_Void* pPKIConfig); 51 | 52 | OPCUA_END_EXTERN_C 53 | #endif 54 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_semaphore.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Semaphore_Create( OpcUa_Semaphore* phRawSemaphore, 31 | OpcUa_UInt32 uInitalValue, 32 | OpcUa_UInt32 uMaxRange); 33 | 34 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Semaphore_Delete( OpcUa_Semaphore* phRawSemaphore); 35 | 36 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Semaphore_Wait( OpcUa_Semaphore hRawSemaphore); 37 | 38 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Semaphore_TimedWait(OpcUa_Semaphore hRawSemaphore, 39 | OpcUa_UInt32 msecTimeout); 40 | 41 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Semaphore_Post( OpcUa_Semaphore hRawSemaphore, 42 | OpcUa_UInt32 uReleaseCount); 43 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_socket_udp.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #ifndef _OpcUa_Socket_Udp_H_ 31 | #define _OpcUa_Socket_Udp_H_ 1 32 | 33 | OPCUA_BEGIN_EXTERN_C 34 | 35 | /*============================================================================ 36 | * Create a UDP sender socket 37 | *===========================================================================*/ 38 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_SocketUdp_CreateSender( OpcUa_StringA a_LocalIpAddress, 39 | OpcUa_StringA a_RemoteIpAddress, 40 | OpcUa_Int16 a_RemotePort, 41 | OpcUa_Byte a_TimeToLive, 42 | OpcUa_Socket* a_pSocket); 43 | 44 | /*============================================================================ 45 | * Create a UDP receiver socket 46 | *===========================================================================*/ 47 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_SocketUdp_CreateReceiver( OpcUa_StringA a_LocalIpAddress, 48 | OpcUa_StringA a_RemoteIpAddress, 49 | OpcUa_Int16 a_RemotePort, 50 | OpcUa_Socket* a_pSocket); 51 | 52 | OPCUA_END_EXTERN_C 53 | 54 | #endif /* _OpcUa_Socket_Udp_H_ */ 55 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_thread.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | /*============================================================================ 31 | * Create a platform thread 32 | *===========================================================================*/ 33 | OpcUa_StatusCode OpcUa_P_Thread_Create( OpcUa_RawThread* pThread); 34 | 35 | /*============================================================================ 36 | * Delete Raw Thread 37 | *===========================================================================*/ 38 | OpcUa_Void OpcUa_P_Thread_Delete( OpcUa_RawThread* pRawThread); 39 | 40 | /*============================================================================ 41 | * Start Thread 42 | *===========================================================================*/ 43 | OpcUa_StatusCode OpcUa_P_Thread_Start( OpcUa_RawThread pThread, 44 | OpcUa_PfnInternalThreadMain pfnStartFunction, 45 | OpcUa_Void* pArguments); 46 | 47 | /*============================================================================ 48 | * Send the thread to sleep. 49 | *===========================================================================*/ 50 | OpcUa_Void OpcUa_P_Thread_Sleep( OpcUa_UInt32 msecTimeout); 51 | 52 | /*============================================================================ 53 | * Get Current Thread Id 54 | *===========================================================================*/ 55 | /* the return type "unsigned long" is necessary to hold a "pthread_t" value */ 56 | unsigned long OpcUa_P_Thread_GetCurrentThreadId( void); 57 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_trace.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | /*============================================================================ 31 | * Trace Initialize 32 | *===========================================================================*/ 33 | /** 34 | * Initialize all resources needed for tracing. 35 | */ 36 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Trace_Initialize(void); 37 | 38 | /*============================================================================ 39 | * Trace Initialize 40 | *===========================================================================*/ 41 | /** 42 | * Clear all resources needed for tracing. 43 | */ 44 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Trace_Clear(void); 45 | 46 | /*============================================================================ 47 | * Tracefunction 48 | *===========================================================================*/ 49 | /** 50 | * Writes the given string to the trace device, if the given trace level is 51 | * activated in the header file. 52 | */ 53 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Trace( 54 | #if OPCUA_TRACE_FILE_LINE_INFO 55 | OpcUa_UInt32 level, 56 | OpcUa_CharA* sFile, 57 | OpcUa_UInt32 line, 58 | #endif 59 | OpcUa_CharA* a_sMessage); 60 | -------------------------------------------------------------------------------- /stack/Stack/platforms/linux/opcua_p_utilities.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #ifndef _OpcUa_P_Utilities_H_ 31 | #define _OpcUa_P_Utilities_H_ 1 32 | 33 | OPCUA_BEGIN_EXTERN_C 34 | 35 | /** 36 | * @see OpcUa_P_QSort 37 | */ 38 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_QSort( OpcUa_Void* pElements, 39 | OpcUa_UInt32 nElementCount, 40 | OpcUa_UInt32 nElementSize, 41 | OpcUa_PfnCompare* pfnCompare, 42 | OpcUa_Void* pContext); 43 | 44 | /** 45 | * @see OpcUa_P_BSearch 46 | */ 47 | OpcUa_Void* OPCUA_DLLCALL OpcUa_P_BSearch( OpcUa_Void* pKey, 48 | OpcUa_Void* pElements, 49 | OpcUa_UInt32 nElementCount, 50 | OpcUa_UInt32 nElementSize, 51 | OpcUa_PfnCompare* pfnCompare, 52 | OpcUa_Void* pContext); 53 | 54 | /** 55 | * @see OpcUa_P_GetLastError 56 | */ 57 | OpcUa_UInt32 OPCUA_DLLCALL OpcUa_P_GetLastError(void); 58 | 59 | /** 60 | * @see OpcUa_P_GetTickCount 61 | */ 62 | OpcUa_UInt32 OPCUA_DLLCALL OpcUa_P_GetTickCount(void); 63 | 64 | /** 65 | * @see OpcUa_P_CharAToInt 66 | */ 67 | OpcUa_Int32 OPCUA_DLLCALL OpcUa_P_CharAToInt( OpcUa_StringA sValue); 68 | 69 | /** 70 | * @see OpcUa_P_ParseUrl 71 | */ 72 | OpcUa_StatusCode OpcUa_P_ParseUrl( OpcUa_StringA psUrl, 73 | OpcUa_StringA* psIpAddress, 74 | OpcUa_UInt16* puPort); 75 | 76 | OPCUA_END_EXTERN_C 77 | 78 | #endif /* _OpcUa_P_Utilities_H_ */ 79 | -------------------------------------------------------------------------------- /stack/Stack/platforms/win32/opcua_p_cryptofactory.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #ifndef _OpcUa_P_CryptoFactory_H_ 31 | #define _OpcUa_P_CryptoFactory_H_ 1 32 | 33 | OPCUA_BEGIN_EXTERN_C 34 | 35 | /** 36 | @brief OpcUa_CryptoFactory_CreateCryptoProvider. 37 | 38 | @param securityPolicy [in] The security policy. 39 | @param pProvider [out] The resulting CryptoProvider. 40 | */ 41 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_CryptoFactory_CreateCryptoProvider( OpcUa_StringA Uri, 42 | OpcUa_CryptoProvider* pProvider); 43 | 44 | /** 45 | @brief OpcUa_CryptoFactory_DeleteCryptoProvider. 46 | 47 | @param pProvider [out] The resulting CryptoProvider. 48 | */ 49 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_CryptoFactory_DeleteCryptoProvider( OpcUa_CryptoProvider* pProvider); 50 | 51 | OPCUA_END_EXTERN_C 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /stack/Stack/platforms/win32/opcua_p_datetime.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | /******************************************************************************************************/ 31 | /* Platform Portability Layer */ 32 | /* Modify the content of this file according to the event implementation on your system. */ 33 | /* This is the win32 implementation */ 34 | /******************************************************************************************************/ 35 | 36 | /** 37 | * @brief Returns the current time in UTC. 38 | */ 39 | OpcUa_DateTime OPCUA_DLLCALL OpcUa_P_DateTime_UtcNow(void); 40 | 41 | /** 42 | * @brief Returns the time in OpcUa_TimeVal format. 43 | */ 44 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_DateTime_GetTimeOfDay(OpcUa_TimeVal* pValue); 45 | 46 | /** 47 | * @brief Converts the given OpcUa_DateTime into an ascii string. 48 | * 49 | * @param DateTime [in] The DateTime value to convert. 50 | * @param Buffer [in/out] At least 25 bytes of buffer. 51 | * @param DateTime [in] The length of the given buffer. 52 | * 53 | * @return Error Code 54 | */ 55 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_DateTime_GetStringFromDateTime( OpcUa_DateTime datetime, 56 | OpcUa_StringA buffer, 57 | OpcUa_UInt32 length); 58 | 59 | /** 60 | * @brief Converts the given (ascii) string into OpcUa_DateTime format. 61 | * 62 | * @param DateTimeString [in] Buffer containing the DateTime string. Must not be OpcUa_Null! 63 | * @param DateTime [out] Pointer to the OpcUa_DateTime value in which the converted value will be stored. 64 | * 65 | * @return Status Code. 66 | */ 67 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_DateTime_GetDateTimeFromString( OpcUa_StringA DateTimeString, 68 | OpcUa_DateTime* DateTime); 69 | -------------------------------------------------------------------------------- /stack/Stack/platforms/win32/opcua_p_guid.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | /******************************************************************************************************/ 31 | /* Platform Portability Layer */ 32 | /* Modify the content of this file according to the socket implementation on your system. */ 33 | /******************************************************************************************************/ 34 | 35 | /*============================================================================ 36 | * CreateGuid 37 | *===========================================================================*/ 38 | /** 39 | * Create a GUID in binary format. 40 | */ 41 | OpcUa_Guid* OPCUA_DLLCALL OpcUa_P_Guid_Create(OpcUa_Guid* Guid); 42 | -------------------------------------------------------------------------------- /stack/Stack/platforms/win32/opcua_p_memory.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #ifndef _OpcUa_P_Memory_H_ 31 | #define _OpcUa_P_Memory_H_ 1 32 | 33 | OPCUA_BEGIN_EXTERN_C 34 | 35 | typedef OpcUa_Void* (OPCUA_DLLCALL *OpcUa_P_Memory_Alloc_Func)(OpcUa_UInt32); 36 | typedef OpcUa_Void* (OPCUA_DLLCALL *OpcUa_P_Memory_ReAlloc_Func)(OpcUa_Void*, OpcUa_UInt32); 37 | typedef OpcUa_Void (OPCUA_DLLCALL *OpcUa_P_Memory_Free_Func)(OpcUa_Void*); 38 | 39 | OPCUA_EXPORT 40 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Set_Memory_Functions( OpcUa_P_Memory_Alloc_Func pMalloc, 41 | OpcUa_P_Memory_ReAlloc_Func pReAlloc, 42 | OpcUa_P_Memory_Free_Func pFree); 43 | 44 | /** 45 | * @see OpcUa_Memory_Alloc 46 | */ 47 | OpcUa_Void* OPCUA_DLLCALL OpcUa_P_Memory_Alloc( OpcUa_UInt32 nSize); 48 | 49 | /** 50 | * @brief Reallocates a new block of memory 51 | * 52 | * @param pBuffer [in] The existing memory block. 53 | * @param nSize [in] The size of the block to allocate. 54 | */ 55 | OpcUa_Void* OPCUA_DLLCALL OpcUa_P_Memory_ReAlloc( OpcUa_Void* pBuffer, 56 | OpcUa_UInt32 nSize); 57 | 58 | /** 59 | * @see OpcUa_Memory_Free 60 | */ 61 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Memory_Free( OpcUa_Void* pvBuffer); 62 | 63 | /** 64 | * @see OpcUa_Memory_MemCpy 65 | */ 66 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Memory_MemCpy( OpcUa_Void* pBuffer, 67 | OpcUa_UInt32 nSizeInBytes, 68 | OpcUa_Void* pSource, 69 | OpcUa_UInt32 nCount); 70 | 71 | OPCUA_END_EXTERN_C 72 | 73 | #endif /* _OpcUa_P_Memory_H_ */ 74 | -------------------------------------------------------------------------------- /stack/Stack/platforms/win32/opcua_p_mutex.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | /******************************************************************************************************/ 31 | /* Platform Portability Layer */ 32 | /******************************************************************************************************/ 33 | 34 | #if OPCUA_MUTEX_ERROR_CHECKING 35 | #define OpcUa_P_Mutex_Create(xMutex) OpcUa_P_Mutex_CreateImp( xMutex, __FILE__, __LINE__) 36 | #define OpcUa_P_Mutex_Delete(xMutex) OpcUa_P_Mutex_DeleteImp( xMutex, __FILE__, __LINE__) 37 | #define OpcUa_P_Mutex_Lock(xMutex) OpcUa_P_Mutex_LockImp( xMutex, __FILE__, __LINE__) 38 | #define OpcUa_P_Mutex_Unlock(xMutex) OpcUa_P_Mutex_UnlockImp( xMutex, __FILE__, __LINE__) 39 | #else /* OPCUA_MUTEX_ERROR_CHECKING */ 40 | #define OpcUa_P_Mutex_Create(xMutex) OpcUa_P_Mutex_CreateImp( xMutex) 41 | #define OpcUa_P_Mutex_Delete(xMutex) OpcUa_P_Mutex_DeleteImp( xMutex) 42 | #define OpcUa_P_Mutex_Lock(xMutex) OpcUa_P_Mutex_LockImp( xMutex) 43 | #define OpcUa_P_Mutex_Unlock(xMutex) OpcUa_P_Mutex_UnlockImp( xMutex) 44 | #endif /* OPCUA_MUTEX_ERROR_CHECKING */ 45 | 46 | #if OPCUA_MUTEX_ERROR_CHECKING 47 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Mutex_CreateImp( OpcUa_Mutex* phMutex, char* file, int line); 48 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_DeleteImp( OpcUa_Mutex* phMutex, char* file, int line); 49 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_LockImp( OpcUa_Mutex hMutex, char* file, int line); 50 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_UnlockImp( OpcUa_Mutex hMutex, char* file, int line); 51 | #else 52 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Mutex_CreateImp( OpcUa_Mutex* phMutex); 53 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_DeleteImp( OpcUa_Mutex* phMutex); 54 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_LockImp( OpcUa_Mutex hMutex); 55 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Mutex_UnlockImp( OpcUa_Mutex hMutex); 56 | #endif 57 | -------------------------------------------------------------------------------- /stack/Stack/platforms/win32/opcua_p_pkifactory.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #ifndef _OpcUa_P_PKIFactory_H_ 31 | #define _OpcUa_P_PKIFactory_H_ 1 32 | 33 | OPCUA_BEGIN_EXTERN_C 34 | /** 35 | @brief Create the PKI Factory object 36 | */ 37 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_PKIFactory_CreatePKIProvider( OpcUa_Void* pCertificateStoreConfig, 38 | OpcUa_PKIProvider* pProvider); 39 | 40 | /** 41 | @brief Delete the PKI Factory object 42 | */ 43 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_PKIFactory_DeletePKIProvider( OpcUa_PKIProvider* pProvider); 44 | 45 | /** 46 | @brief Extract DH parameter file name from PKI Config 47 | Return NULL if not available 48 | */ 49 | OpcUa_StringA OpcUa_P_PKIFactory_GetDHParamFileName(OpcUa_Void* pPKIConfig); 50 | OPCUA_END_EXTERN_C 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /stack/Stack/platforms/win32/opcua_p_semaphore.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | /******************************************************************************************************/ 31 | /* Platform Portability Layer */ 32 | /******************************************************************************************************/ 33 | 34 | 35 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Semaphore_Create( OpcUa_Semaphore* phRawSemaphore, 36 | OpcUa_UInt32 uInitalValue, 37 | OpcUa_UInt32 uMaxRange); 38 | 39 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Semaphore_Delete( OpcUa_Semaphore* phRawSemaphore); 40 | 41 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Semaphore_Wait( OpcUa_Semaphore hRawSemaphore); 42 | 43 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Semaphore_TimedWait(OpcUa_Semaphore hRawSemaphore, 44 | OpcUa_UInt32 msecTimeout); 45 | 46 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Semaphore_Post( OpcUa_Semaphore hRawSemaphore, 47 | OpcUa_UInt32 uReleaseCount); 48 | -------------------------------------------------------------------------------- /stack/Stack/platforms/win32/opcua_p_socket_udp.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #ifndef _OpcUa_Socket_Udp_H_ 31 | #define _OpcUa_Socket_Udp_H_ 1 32 | 33 | OPCUA_BEGIN_EXTERN_C 34 | 35 | /*============================================================================ 36 | * Create a UDP sender socket 37 | *===========================================================================*/ 38 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_SocketUdp_CreateSender( OpcUa_StringA a_LocalIpAddress, 39 | OpcUa_StringA a_RemoteIpAddress, 40 | OpcUa_Int16 a_RemotePort, 41 | OpcUa_Byte a_TimeToLive, 42 | OpcUa_Socket* a_pSocket); 43 | 44 | /*============================================================================ 45 | * Create a UDP receiver socket 46 | *===========================================================================*/ 47 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_SocketUdp_CreateReceiver( OpcUa_StringA a_LocalIpAddress, 48 | OpcUa_StringA a_RemoteIpAddress, 49 | OpcUa_Int16 a_RemotePort, 50 | OpcUa_Socket* a_pSocket); 51 | 52 | OPCUA_END_EXTERN_C 53 | 54 | #endif /* _OpcUa_Socket_Udp_H_ */ 55 | -------------------------------------------------------------------------------- /stack/Stack/platforms/win32/opcua_p_thread.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | /******************************************************************************************************/ 31 | /* Platform Portability Layer */ 32 | /******************************************************************************************************/ 33 | 34 | /*============================================================================ 35 | * Create a platform thread 36 | *===========================================================================*/ 37 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Thread_Create( OpcUa_RawThread* pThread); 38 | 39 | /*============================================================================ 40 | * Delete Raw Thread 41 | *===========================================================================*/ 42 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Thread_Delete( OpcUa_RawThread* pRawThread); 43 | 44 | /*============================================================================ 45 | * Start Thread 46 | *===========================================================================*/ 47 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Thread_Start( OpcUa_RawThread pThread, 48 | OpcUa_PfnInternalThreadMain pfnStartFunction, 49 | OpcUa_Void* pArguments); 50 | 51 | /*============================================================================ 52 | * Send the thread to sleep. 53 | *===========================================================================*/ 54 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Thread_Sleep( OpcUa_UInt32 msecTimeout); 55 | 56 | /*============================================================================ 57 | * Get Current Thread Id 58 | *===========================================================================*/ 59 | OpcUa_UInt32 OPCUA_DLLCALL OpcUa_P_Thread_GetCurrentThreadId(void); 60 | -------------------------------------------------------------------------------- /stack/Stack/platforms/win32/opcua_p_trace.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | /******************************************************************************************************/ 31 | /* Platform Portability Layer */ 32 | /******************************************************************************************************/ 33 | 34 | /*============================================================================ 35 | * Trace Initialize 36 | *===========================================================================*/ 37 | /** 38 | * Initialize all resources needed for tracing. 39 | */ 40 | OpcUa_StatusCode OPCUA_DLLCALL OpcUa_P_Trace_Initialize(void); 41 | 42 | /*============================================================================ 43 | * Trace Initialize 44 | *===========================================================================*/ 45 | /** 46 | * Clear all resources needed for tracing. 47 | */ 48 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Trace_Clear(void); 49 | 50 | /*============================================================================ 51 | * Tracefunction 52 | *===========================================================================*/ 53 | /** 54 | * Writes the given string to the trace device, if the given trace level is 55 | * activated in the header file. 56 | */ 57 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_Trace( 58 | #if OPCUA_TRACE_FILE_LINE_INFO 59 | OpcUa_UInt32 level, 60 | OpcUa_CharA* sFile, 61 | OpcUa_UInt32 line, 62 | #endif 63 | OpcUa_CharA* a_sMessage); 64 | -------------------------------------------------------------------------------- /stack/Stack/platforms/win32/opcua_p_utilities.h: -------------------------------------------------------------------------------- 1 | /* ======================================================================== 2 | * Copyright (c) 2005-2018 The OPC Foundation, Inc. All rights reserved. 3 | * 4 | * OPC Foundation MIT License 1.00 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | * OTHER DEALINGS IN THE SOFTWARE. 25 | * 26 | * The complete license agreement can be found here: 27 | * http://opcfoundation.org/License/MIT/1.00/ 28 | * ======================================================================*/ 29 | 30 | #ifndef _OpcUa_P_Utilities_H_ 31 | #define _OpcUa_P_Utilities_H_ 1 32 | 33 | OPCUA_BEGIN_EXTERN_C 34 | 35 | /** 36 | * @see OpcUa_P_QSort 37 | */ 38 | OpcUa_Void OPCUA_DLLCALL OpcUa_P_QSort( OpcUa_Void* pElements, 39 | OpcUa_UInt32 nElementCount, 40 | OpcUa_UInt32 nElementSize, 41 | OpcUa_PfnCompare* pfnCompare, 42 | OpcUa_Void* pContext); 43 | 44 | /** 45 | * @see OpcUa_P_BSearch 46 | */ 47 | OpcUa_Void* OPCUA_DLLCALL OpcUa_P_BSearch( OpcUa_Void* pKey, 48 | OpcUa_Void* pElements, 49 | OpcUa_UInt32 nElementCount, 50 | OpcUa_UInt32 nElementSize, 51 | OpcUa_PfnCompare* pfnCompare, 52 | OpcUa_Void* pContext); 53 | 54 | /** 55 | * @see OpcUa_P_GetLastError 56 | */ 57 | OpcUa_UInt32 OPCUA_DLLCALL OpcUa_P_GetLastError(void); 58 | 59 | /** 60 | * @see OpcUa_P_GetTickCount 61 | */ 62 | OpcUa_UInt32 OPCUA_DLLCALL OpcUa_P_GetTickCount(void); 63 | 64 | /** 65 | * @see OpcUa_P_CharAToInt 66 | */ 67 | OpcUa_Int32 OPCUA_DLLCALL OpcUa_P_CharAToInt( OpcUa_StringA sValue); 68 | 69 | /** 70 | * @see OpcUa_P_ParseUrl 71 | */ 72 | OpcUa_StatusCode OpcUa_P_ParseUrl( OpcUa_StringA psUrl, 73 | OpcUa_StringA* psIpAdress, 74 | OpcUa_UInt16* puPort); 75 | 76 | OPCUA_END_EXTERN_C 77 | 78 | #endif /* _OpcUa_P_Utilities_H_ */ 79 | -------------------------------------------------------------------------------- /stack/Stack/proxystub/serverstub/opcua_endpoint_internal.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_Endpoint_Internal_H_ 18 | #define _OpcUa_Endpoint_Internal_H_ 1 19 | 20 | OPCUA_BEGIN_EXTERN_C 21 | 22 | /* @brief Return invalid state if endpoint is not open. */ 23 | #define OPCUA_ENDPOINT_CHECKOPEN(xEndpoint) \ 24 | OpcUa_ReturnErrorIfTrue((((OpcUa_EndpointInternal*)xEndpoint)->State != eOpcUa_Endpoint_State_Open), OpcUa_BadInvalidState); 25 | 26 | /*============================================================================ 27 | * OpcUa_Endpoint_State 28 | *===========================================================================*/ 29 | /** 30 | * @brief Describes the current state of the endpoint object. 31 | */ 32 | enum _OpcUa_Endpoint_State 33 | { 34 | eOpcUa_Endpoint_State_Invalid, 35 | eOpcUa_Endpoint_State_Open, 36 | eOpcUa_Endpoint_State_Closed 37 | }; 38 | typedef enum _OpcUa_Endpoint_State OpcUa_Endpoint_State; 39 | 40 | /*============================================================================ 41 | * OpcUa_EndpointInternal 42 | *===========================================================================*/ 43 | /** 44 | * @brief Manages an endpoint for a server. (internal representation) 45 | */ 46 | typedef struct _OpcUa_EndpointInternal 47 | { 48 | /*! @brief An opaque handle associated with the endpoint. */ 49 | OpcUa_Handle Handle; 50 | 51 | /*! @brief The current state of the endpoint. */ 52 | OpcUa_Endpoint_State State; 53 | 54 | /*! @brief The url for the endpoint. */ 55 | OpcUa_String Url; 56 | 57 | /*! @brief The type of encoding to use with the endpoint. */ 58 | OpcUa_EncoderType EncoderType; 59 | 60 | /*! @brief The secure channel callback from application layer. */ 61 | OpcUa_Endpoint_PfnEndpointCallback* pfEndpointCallback; 62 | 63 | /*! @brief The data to pass to the applications callback. */ 64 | OpcUa_Void* pvEndpointCallbackData; 65 | 66 | /*! @brief The listener for the transport layer. */ 67 | struct _OpcUa_Listener* TransportListener; 68 | 69 | /*! @brief The listener for the security layer. */ 70 | struct _OpcUa_Listener* SecureListener; 71 | 72 | /*! @brief The encoder used for messages sent via the endpoint. */ 73 | struct _OpcUa_Encoder* Encoder; 74 | 75 | /*! @brief The decoder used for messages received via the endpoint. */ 76 | struct _OpcUa_Decoder* Decoder; 77 | 78 | /*! @brief The services supported by the endpoint. */ 79 | OpcUa_ServiceTable SupportedServices; 80 | 81 | /*! @brief A mutex used to synchronize access to the endpoint structure. */ 82 | OpcUa_Mutex Mutex; 83 | 84 | /*! @brief The current status of the endpoint. */ 85 | OpcUa_StatusCode Status; 86 | } OpcUa_EndpointInternal; 87 | 88 | OPCUA_END_EXTERN_C 89 | 90 | #endif /* _OpcUa_Endpoint_Internal_H_ */ 91 | -------------------------------------------------------------------------------- /stack/Stack/proxystub/serverstub/opcua_serverstub.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_ServerStub_H_ 18 | #define _OpcUa_ServerStub_H_ 19 | 20 | /* core */ 21 | #include "opcua_proxystub.h" 22 | 23 | /* proxystub_serverstub */ 24 | #include "opcua_endpoint.h" 25 | #include "opcua_servicetable.h" 26 | #include "opcua_serverapi.h" 27 | 28 | #endif /* _OpcUa_ServerStub_H_ */ 29 | 30 | -------------------------------------------------------------------------------- /stack/Stack/securechannel/opcua_securechannel_types.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_SecureChannel_Types_H_ 18 | #define _OpcUa_SecureChannel_Types_H_ 1 19 | 20 | /*============================================================================ 21 | * OpcUa_SecureMessageType 22 | *===========================================================================*/ 23 | typedef enum _OpcUa_SecureMessageType 24 | { 25 | OpcUa_SecureMessageType_SO, /* SecureChannelOpen */ 26 | OpcUa_SecureMessageType_SC, /* SecureChannelClose */ 27 | OpcUa_SecureMessageType_SM, /* SecureMessage */ 28 | OpcUa_SecureMessageType_UN /* Unknown Message */ 29 | } OpcUa_SecureMessageType; 30 | 31 | #define OPCUA_SECURECHANNEL_MESSAGESECURITYMODE_INVALID 0x00 32 | #define OPCUA_SECURECHANNEL_MESSAGESECURITYMODE_NONE 0x01 33 | #define OPCUA_SECURECHANNEL_MESSAGESECURITYMODE_SIGN 0x02 34 | #define OPCUA_SECURECHANNEL_MESSAGESECURITYMODE_SIGNANDENCRYPT 0x04 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /stack/Stack/securechannel/opcua_securelistener_policymanager.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef OpcUa_SecureListener_PolicyManager_ 18 | #define OpcUa_SecureListener_PolicyManager_ 1 19 | 20 | #ifdef OPCUA_HAVE_SERVERAPI 21 | 22 | OPCUA_BEGIN_EXTERN_C 23 | 24 | /************************************************************************************/ 25 | 26 | /** 27 | * @brief Being part of a specific SecureListener, it manages the secure channel and connections. 28 | */ 29 | struct _OpcUa_SecureListener_PolicyManager 30 | { 31 | /* @brief A list with current SecurityPolicies (OpcUa_String) */ 32 | OpcUa_List* SecurityPolicies; 33 | }; 34 | 35 | typedef struct _OpcUa_SecureListener_PolicyManager OpcUa_SecureListener_PolicyManager; 36 | 37 | /************************************************************************************/ 38 | 39 | /* @brief */ 40 | OpcUa_StatusCode OpcUa_SecureListener_PolicyManager_Create( 41 | OpcUa_SecureListener_PolicyManager** ppPolicyManager); 42 | 43 | /* @brief */ 44 | OpcUa_StatusCode OpcUa_SecureListener_PolicyManager_Initialize( 45 | OpcUa_SecureListener_PolicyManager* pPolicyManager); 46 | 47 | /* @brief */ 48 | OpcUa_Void OpcUa_SecureListener_PolicyManager_Delete( 49 | OpcUa_SecureListener_PolicyManager** ppPolicyManager); 50 | 51 | /* @brief */ 52 | OpcUa_Void OpcUa_SecureListener_PolicyManager_ClearAll( 53 | OpcUa_SecureListener_PolicyManager* pPolicyManager); 54 | 55 | /************************************************************************************/ 56 | 57 | /* @brief */ 58 | OpcUa_StatusCode OpcUa_SecureListener_PolicyManager_IsValidSecurityPolicy( 59 | OpcUa_SecureListener_PolicyManager* pPolicyManager, 60 | OpcUa_String* pSecurityPolicyUri); 61 | 62 | /* @brief */ 63 | OpcUa_Void OpcUa_SecureListener_PolicyManager_ClearSecurityPolicyConfigurations( 64 | OpcUa_SecureListener_PolicyManager* pPolicyManager); 65 | 66 | /* @brief */ 67 | OpcUa_StatusCode OpcUa_SecureListener_PolicyManager_IsValidSecurityPolicyConfiguration( 68 | OpcUa_SecureListener_PolicyManager* pPolicyManager, 69 | OpcUa_SecureListener_SecurityPolicyConfiguration* pSecurityPolicyConfiguration); 70 | 71 | /* @brief */ 72 | OpcUa_StatusCode OpcUa_SecureListener_PolicyManager_AddSecurityPolicyConfiguration( 73 | OpcUa_SecureListener_PolicyManager* a_pPolicyManager, 74 | OpcUa_SecureListener_SecurityPolicyConfiguration* a_pPolicyConfiguration); 75 | 76 | /* @brief */ 77 | OpcUa_StatusCode OpcUa_SecureListener_PolicyManager_GetAllSecurityPolicies( 78 | OpcUa_SecureListener_PolicyManager* pPolicyManager, 79 | OpcUa_UInt16* pNoOfSecurityPolicies, 80 | OpcUa_String** ppSecurityPolicyUris); 81 | 82 | OPCUA_END_EXTERN_C 83 | 84 | #endif /* OPCUA_HAVE_SERVERAPI */ 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /stack/Stack/securechannel/opcua_soapsecurechannel.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | -------------------------------------------------------------------------------- /stack/Stack/securechannel/opcua_soapsecurechannel.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | struct _OpcUa_SoapSecureChannel 18 | { 19 | OpcUa_UInt32 SecureChannelId; 20 | }; 21 | 22 | typedef struct _OpcUa_SoapSecureChannel OpcUa_SoapSecureChannel; 23 | -------------------------------------------------------------------------------- /stack/Stack/securechannel/opcua_tcpsecurechannel.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_TcpSecureChannel_H_ 18 | #define _OpcUa_TcpSecureChannel_H_ 1 19 | 20 | OPCUA_BEGIN_EXTERN_C 21 | /** 22 | @brief The Tcp SecureChannel. 23 | */ 24 | struct _OpcUa_TcpSecureChannel 25 | { 26 | /** @brief Just a dummy to keep. */ 27 | OpcUa_Void* pvDummy; 28 | }; 29 | 30 | typedef struct _OpcUa_TcpSecureChannel OpcUa_TcpSecureChannel; 31 | 32 | /** 33 | @brief Creates a new securechannel object. 34 | 35 | A secure connection is always layered on top of a regular connection. 36 | 37 | @param ppSecureChannel [out] The new securechannel. 38 | */ 39 | OpcUa_StatusCode OpcUa_TcpSecureChannel_Create(OpcUa_SecureChannel** ppSecureChannel); 40 | 41 | /** 42 | @brief Deletes a securechannel object. 43 | 44 | A secure connection is always layered on top of a regular connection. 45 | 46 | @param ppSecureChannel [in] The securechannel to delete. 47 | */ 48 | OpcUa_StatusCode OpcUa_TcpSecureChannel_Delete(OpcUa_SecureChannel** ppSecureChannel); 49 | 50 | OPCUA_END_EXTERN_C 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /stack/Stack/stackcore/opcua_credentials.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_Credentials_H_ 18 | #define _OpcUa_Credentials_H_ 1 19 | 20 | OPCUA_BEGIN_EXTERN_C 21 | 22 | /*============================================================================ 23 | * OpcUa_ActualCredential 24 | * 25 | * An actually used credential. 26 | *===========================================================================*/ 27 | typedef struct _OpcUa_ActualCredential 28 | { 29 | OpcUa_ByteString* pClientCertificate; 30 | OpcUa_Key* pClientPrivateKey; 31 | OpcUa_ByteString* pServerCertificate; 32 | OpcUa_Void* pkiConfig; 33 | OpcUa_String* pRequestedSecurityPolicyUri; 34 | OpcUa_Int32 nRequestedLifetime; 35 | OpcUa_MessageSecurityMode messageSecurityMode; 36 | } 37 | OpcUa_ActualCredential; 38 | 39 | /*============================================================================ 40 | * OpcUa_ClientCredential 41 | * 42 | * A union of all possible credential types. 43 | * 44 | *===========================================================================*/ 45 | typedef struct _OpcUa_ClientCredential 46 | { 47 | union 48 | { 49 | OpcUa_ActualCredential TheActuallyUsedCredential; 50 | } 51 | Credential; 52 | } 53 | OpcUa_ClientCredential; 54 | 55 | OPCUA_END_EXTERN_C 56 | 57 | #endif /* _OpcUa_Credentials_H_ */ 58 | -------------------------------------------------------------------------------- /stack/Stack/stackcore/opcua_decoder.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | /*============================================================================ 22 | * OpcUa_Decoder_Close 23 | *===========================================================================*/ 24 | OpcUa_Void OpcUa_Decoder_Close( 25 | struct _OpcUa_Decoder* a_pDecoder, 26 | OpcUa_Handle* a_phDecodeContext) 27 | { 28 | if (a_pDecoder != OpcUa_Null && a_pDecoder->Delete != OpcUa_Null) 29 | { 30 | a_pDecoder->Close(a_pDecoder, a_phDecodeContext); 31 | } 32 | } 33 | 34 | /*============================================================================ 35 | * OpcUa_Decoder_Delete 36 | *===========================================================================*/ 37 | OpcUa_Void OpcUa_Decoder_Delete( 38 | struct _OpcUa_Decoder** a_ppDecoder) 39 | { 40 | if (a_ppDecoder != OpcUa_Null && *a_ppDecoder != OpcUa_Null && (*a_ppDecoder)->Delete != OpcUa_Null) 41 | { 42 | (*a_ppDecoder)->Delete(a_ppDecoder); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /stack/Stack/stackcore/opcua_encoder.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | /*============================================================================ 21 | * OpcUa_Encoder_Close 22 | *===========================================================================*/ 23 | OpcUa_Void OpcUa_Encoder_Close( 24 | struct _OpcUa_Encoder* a_pEncoder, 25 | OpcUa_Handle* a_phEncodeContext) 26 | { 27 | if (a_pEncoder != OpcUa_Null && a_pEncoder->Delete != OpcUa_Null) 28 | { 29 | a_pEncoder->Close(a_pEncoder, a_phEncodeContext); 30 | } 31 | } 32 | 33 | /*============================================================================ 34 | * OpcUa_Encoder_Delete 35 | *===========================================================================*/ 36 | OpcUa_Void OpcUa_Encoder_Delete( 37 | struct _OpcUa_Encoder** a_ppEncoder) 38 | { 39 | if (a_ppEncoder != OpcUa_Null && *a_ppEncoder != OpcUa_Null && (*a_ppEncoder)->Delete != OpcUa_Null) 40 | { 41 | (*a_ppEncoder)->Delete(a_ppEncoder); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /stack/Stack/stackcore/opcua_enumeratedtype.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | /*============================================================================ 21 | * OpcUa_EnumeratedType_FindName 22 | *===========================================================================*/ 23 | OpcUa_StatusCode OpcUa_EnumeratedType_FindName( 24 | OpcUa_EnumeratedType* a_pType, 25 | OpcUa_Int32 a_nValue, 26 | OpcUa_StringA* a_pName) 27 | { 28 | OpcUa_UInt32 ii = 0; 29 | 30 | OpcUa_InitializeStatus(OpcUa_Module_Serializer, "EnumeratedType_FindName"); 31 | 32 | OpcUa_ReturnErrorIfArgumentNull(a_pType); 33 | OpcUa_ReturnErrorIfArgumentNull(a_pName); 34 | 35 | *a_pName = OpcUa_Null; 36 | 37 | for (ii = 0; a_pType->Values[ii].Name != OpcUa_Null; ii++) 38 | { 39 | if (a_pType->Values[ii].Value == a_nValue) 40 | { 41 | *a_pName = a_pType->Values[ii].Name; 42 | break; 43 | } 44 | } 45 | 46 | OpcUa_GotoErrorIfTrue(a_pType->Values[ii].Name == OpcUa_Null, OpcUa_BadInvalidArgument); 47 | 48 | OpcUa_ReturnStatusCode; 49 | OpcUa_BeginErrorHandling; 50 | 51 | /* nothing to do */ 52 | 53 | OpcUa_FinishErrorHandling; 54 | } 55 | 56 | /*============================================================================ 57 | * OpcUa_EnumeratedType_FindValue 58 | *===========================================================================*/ 59 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_EnumeratedType_FindValue( 60 | OpcUa_EnumeratedType* a_pType, 61 | OpcUa_StringA a_sName, 62 | OpcUa_Int32* a_pValue) 63 | { 64 | OpcUa_UInt32 ii = 0; 65 | 66 | OpcUa_InitializeStatus(OpcUa_Module_Serializer, "EnumeratedType_FindValue"); 67 | 68 | OpcUa_ReturnErrorIfArgumentNull(a_pType); 69 | OpcUa_ReturnErrorIfArgumentNull(a_sName); 70 | OpcUa_ReturnErrorIfArgumentNull(a_pValue); 71 | 72 | *a_pValue = 0; 73 | 74 | for (ii = 0; a_pType->Values[ii].Name != OpcUa_Null; ii++) 75 | { 76 | if (OpcUa_StrCmpA(a_pType->Values[ii].Name, a_sName) == 0) 77 | { 78 | *a_pValue = a_pType->Values[ii].Value; 79 | break; 80 | } 81 | } 82 | 83 | OpcUa_GotoErrorIfTrue(a_pType->Values[ii].Name == OpcUa_Null, OpcUa_BadInvalidArgument); 84 | 85 | OpcUa_ReturnStatusCode; 86 | OpcUa_BeginErrorHandling; 87 | 88 | /* nothing to do */ 89 | 90 | OpcUa_FinishErrorHandling; 91 | } 92 | -------------------------------------------------------------------------------- /stack/Stack/stackcore/opcua_enumeratedtype.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_EnumeratedType_H_ 18 | #define _OpcUa_EnumeratedType_H_ 1 19 | 20 | OPCUA_BEGIN_EXTERN_C 21 | 22 | /** 23 | @brief Describes an enumerated valie. 24 | */ 25 | typedef struct _OpcUa_EnumeratedValue 26 | { 27 | /*! @brief The name. */ 28 | OpcUa_StringA Name; 29 | 30 | /*! @brief The value associated with the name. */ 31 | OpcUa_Int32 Value; 32 | } 33 | OpcUa_EnumeratedValue; 34 | 35 | /** 36 | @brief Describes an enumerated type. 37 | */ 38 | typedef struct _OpcUa_EnumeratedType 39 | { 40 | /*! @brief The name of the enumerated type. */ 41 | OpcUa_StringA TypeName; 42 | 43 | /*! @brief A null terminated list of values. */ 44 | OpcUa_EnumeratedValue* Values; 45 | } 46 | OpcUa_EnumeratedType; 47 | 48 | /** 49 | @brief Finds the name associated with a value of an enumerated type. 50 | 51 | @param pType [in] The enumerated type to search. 52 | @param nValue [in] The value to look for. 53 | @param pName [out] The name associated with the value. 54 | */ 55 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_EnumeratedType_FindName( 56 | OpcUa_EnumeratedType* pType, 57 | OpcUa_Int32 nValue, 58 | OpcUa_StringA* pName); 59 | 60 | /** 61 | @brief Finds the value associated with a name for an enumerated type. 62 | 63 | @param pType [in] The enumerated type to search. 64 | @param sName [in] The name to look for. 65 | @param pValue [out] The value associated with the name. 66 | */ 67 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_EnumeratedType_FindValue( 68 | OpcUa_EnumeratedType* pType, 69 | OpcUa_StringA sName, 70 | OpcUa_Int32* pValue); 71 | 72 | OPCUA_END_EXTERN_C 73 | 74 | #endif /* _OpcUa_EnumeratedType_H_ */ 75 | -------------------------------------------------------------------------------- /stack/Stack/stackcore/opcua_extensionobject.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include 18 | #include 19 | -------------------------------------------------------------------------------- /stack/Stack/stackcore/opcua_extensionobject.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_ExtensionObject_H_ 18 | #define _OpcUa_ExtensionObject_H_ 1 19 | 20 | #include 21 | 22 | OPCUA_BEGIN_EXTERN_C 23 | 24 | OPCUA_END_EXTERN_C 25 | 26 | #endif /* _OpcUa_ExtensionObject_H_ */ 27 | -------------------------------------------------------------------------------- /stack/Stack/stackcore/opcua_messagecontext.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | /*============================================================================ 21 | * OpcUa_MessageContext_Initialize 22 | *===========================================================================*/ 23 | OpcUa_Void OpcUa_MessageContext_Initialize(OpcUa_MessageContext* a_pContext) 24 | { 25 | if (a_pContext != OpcUa_Null) 26 | { 27 | OpcUa_MemSet(a_pContext, 0, sizeof(OpcUa_MessageContext)); 28 | 29 | a_pContext->MaxArrayLength = OpcUa_ProxyStub_g_Configuration.iSerializer_MaxArrayLength; 30 | a_pContext->MaxStringLength = OpcUa_ProxyStub_g_Configuration.iSerializer_MaxStringLength; 31 | a_pContext->MaxByteStringLength = OpcUa_ProxyStub_g_Configuration.iSerializer_MaxByteStringLength; 32 | a_pContext->MaxMessageLength = OpcUa_ProxyStub_g_Configuration.iSerializer_MaxMessageSize; 33 | a_pContext->MaxRecursionDepth = OpcUa_ProxyStub_g_Configuration.iSerializer_MaxRecursionDepth; 34 | } 35 | } 36 | 37 | /*============================================================================ 38 | * OpcUa_MessageContext_Initialize 39 | *===========================================================================*/ 40 | OpcUa_Void OpcUa_MessageContext_Clear(OpcUa_MessageContext* a_pContext) 41 | { 42 | if (a_pContext != OpcUa_Null) 43 | { 44 | OpcUa_MemSet(a_pContext, 0, sizeof(OpcUa_MessageContext)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /stack/Stack/stackcore/opcua_messagecontext.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_MessageContext_H_ 18 | #define _OpcUa_MessageContext_H_ 1 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | OPCUA_BEGIN_EXTERN_C 25 | 26 | /** 27 | @brief Stores data used to construct a message context. 28 | */ 29 | typedef struct _OpcUa_MessageContext 30 | { 31 | /*! @brief The table of namespace URIs used by the server (memory not owned by the context). */ 32 | OpcUa_StringTable* NamespaceUris; 33 | 34 | /*! @brief The table of known encodeable types. */ 35 | OpcUa_EncodeableTypeTable* KnownTypes; 36 | 37 | /*! @brief Whether the encoder should always calculate the size of the encodeable objects (used for debugging) */ 38 | OpcUa_Boolean AlwaysCheckLengths; 39 | 40 | /*! @brief The maximum length for any array. */ 41 | OpcUa_UInt32 MaxArrayLength; 42 | 43 | /*! @brief The maximum length for any String value. */ 44 | OpcUa_UInt32 MaxStringLength; 45 | 46 | /*! @brief The maximum length for any ByteString value. */ 47 | OpcUa_UInt32 MaxByteStringLength; 48 | 49 | /*! @brief The maximum length for any message. */ 50 | OpcUa_UInt32 MaxMessageLength; 51 | 52 | /** The maximum encodable object recursion depth. */ 53 | OpcUa_UInt32 MaxRecursionDepth; 54 | } 55 | OpcUa_MessageContext; 56 | 57 | /** 58 | @brief Puts the context into a known state. 59 | 60 | @param pContext [in] The context to initialize. 61 | */ 62 | OPCUA_EXPORT OpcUa_Void OpcUa_MessageContext_Initialize( 63 | OpcUa_MessageContext* pContext); 64 | 65 | /** 66 | @brief Frees all memory used by a string context. 67 | 68 | @param pContext [in] The context to clear. 69 | */ 70 | OPCUA_EXPORT OpcUa_Void OpcUa_MessageContext_Clear( 71 | OpcUa_MessageContext* pContext); 72 | 73 | /** 74 | @brief Adds a new encoded object position to the context. 75 | 76 | @param pContext [in] The context to update. 77 | @param nStart [in] The stream position for the first byte of the object. 78 | @param nEnd [in] The stream position immediately after the last byte of the object. 79 | */ 80 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_MessageContext_SaveObjectPosition( 81 | OpcUa_MessageContext* pContext, 82 | OpcUa_UInt32 nStart, 83 | OpcUa_UInt32 nEnd); 84 | 85 | /** 86 | @brief Gets the length of an object at the specified position. 87 | 88 | @param pContext [in] The context to search. 89 | @param nStart [in] The stream position for the first byte of the object. 90 | @param iLength [in] The length of the encoded object. 91 | */ 92 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_MessageContext_GetObjectLength( 93 | OpcUa_MessageContext* pContext, 94 | OpcUa_UInt32 nStart, 95 | OpcUa_Int32* iLength); 96 | 97 | OPCUA_END_EXTERN_C 98 | 99 | #endif /* _OpcUa_MessageContext_H_ */ 100 | -------------------------------------------------------------------------------- /stack/Stack/stackcore/opcua_stringtable.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_StringTable_H_ 18 | #define _OpcUa_StringTable_H_ 1 19 | 20 | OPCUA_BEGIN_EXTERN_C 21 | 22 | /** 23 | @brief A table of strings accessible by index. 24 | */ 25 | typedef struct _OpcUa_StringTable 26 | { 27 | /*! @brief The number of entries in the table. */ 28 | OpcUa_UInt32 Count; 29 | 30 | /*! @brief The number of entries allocated in the table. */ 31 | OpcUa_UInt32 Length; 32 | 33 | /*! @brief The table of strings. */ 34 | OpcUa_String* Values; 35 | } 36 | OpcUa_StringTable; 37 | 38 | /** 39 | @brief Puts the table into a known state. 40 | 41 | @param pTable [in] The table to initialize. 42 | */ 43 | OPCUA_EXPORT OpcUa_Void OpcUa_StringTable_Initialize( 44 | OpcUa_StringTable* pTable); 45 | 46 | /** 47 | @brief Frees all memory used by a string table. 48 | 49 | @param pTable [in] The table to clear. 50 | */ 51 | OPCUA_EXPORT OpcUa_Void OpcUa_StringTable_Clear( 52 | OpcUa_StringTable* pTable); 53 | 54 | /** 55 | @brief Adds a null terminated list of strings to the table. 56 | 57 | @param pTable [in] The table to update. 58 | @param pStrings [in] The strings to add. 59 | */ 60 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_StringTable_AddStringList( 61 | OpcUa_StringTable* pTable, 62 | OpcUa_StringA* pStrings); 63 | 64 | /** 65 | @brief Adds an array of strings to the table. 66 | 67 | @param pTable [in] The table to update. 68 | @param pStrings [in] The array of strings to add. 69 | @param nNoOfStrings [in] The number of elements in the array. 70 | */ 71 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_StringTable_AddStrings( 72 | OpcUa_StringTable* pTable, 73 | OpcUa_String* pStrings, 74 | OpcUa_UInt32 nNoOfStrings); 75 | 76 | /** 77 | @brief Finds the index of the specified string. 78 | 79 | @param pTable [in] The string table to search. 80 | @param pString [in] The string to look for. 81 | @param pIndex [out] The index associated with the string. 82 | */ 83 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_StringTable_FindIndex( 84 | OpcUa_StringTable* pTable, 85 | OpcUa_String* pString, 86 | OpcUa_Int32* pIndex); 87 | 88 | /** 89 | @brief Finds the string at the specified index. 90 | 91 | @param pTable [in] The string table to search. 92 | @param nIndex [in] The index to look for. 93 | @param pString [out] The string at the index. 94 | */ 95 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_StringTable_FindString( 96 | OpcUa_StringTable* pTable, 97 | OpcUa_Int32 nIndex, 98 | OpcUa_String* pString); 99 | 100 | OPCUA_END_EXTERN_C 101 | 102 | #endif /* _OpcUa_StringTable_H_ */ 103 | -------------------------------------------------------------------------------- /stack/Stack/transport/https/opcua_httpsconnection.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_HttpsConnection_H_ 18 | #define _OpcUa_HttpsConnection_H_ 1 19 | 20 | #include 21 | 22 | OPCUA_BEGIN_EXTERN_C 23 | 24 | /*============================================================================ 25 | * OpcUa_HttpsConnection_Create 26 | *===========================================================================*/ 27 | OpcUa_StatusCode OpcUa_HttpsConnection_Create(OpcUa_Connection** a_ppConnection); 28 | 29 | /*============================================================================ 30 | * OpcUa_HttpsConnection_GetUsedServerCertificate 31 | *===========================================================================*/ 32 | OpcUa_StatusCode OpcUa_HttpsConnection_GetUsedServerCertificate( 33 | OpcUa_Connection* a_pConnection, 34 | OpcUa_ByteString** a_ppUsedServerCertificate, 35 | OpcUa_StatusCode* a_pValidationResult); 36 | 37 | OPCUA_END_EXTERN_C 38 | 39 | #endif /* _OpcUa_HttpsConnection_H_ */ 40 | -------------------------------------------------------------------------------- /stack/Stack/transport/tcp/opcua_tcpconnection.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | /* HINT: This implementation will become a opaque handle! */ 18 | 19 | #ifndef _OpcUa_TcpConnection_H_ 20 | #define _OpcUa_TcpConnection_H_ 1 21 | 22 | #include 23 | 24 | OPCUA_BEGIN_EXTERN_C 25 | 26 | /*============================================================================ 27 | * OpcUa_TcpConnection_Create 28 | *===========================================================================*/ 29 | OpcUa_StatusCode OpcUa_TcpConnection_Create(OpcUa_Connection** connection); 30 | 31 | OPCUA_END_EXTERN_C 32 | 33 | #endif /* _OpcUa_TcpConnection_H_ */ 34 | -------------------------------------------------------------------------------- /stack/Stack/transport/tcp/opcua_tcplistener.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2018, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef _OpcUa_TcpListener_H_ 18 | #define _OpcUa_TcpListener_H_ 1 19 | 20 | #include 21 | 22 | OPCUA_BEGIN_EXTERN_C 23 | 24 | /** 25 | @brief Creates a new tcp listener object. 26 | 27 | @param listener [out] The new listener. 28 | */ 29 | OPCUA_EXPORT OpcUa_StatusCode OpcUa_TcpListener_Create(OpcUa_Listener** listener); 30 | 31 | OPCUA_END_EXTERN_C 32 | 33 | #endif /* _OpcUa_TcpListener_H_ */ 34 | -------------------------------------------------------------------------------- /stack/build_linux.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | set -e 3 | make -f linux_gcc.mak BUILD_TARGET=debug "$@" 4 | make -f linux_gcc.mak BUILD_TARGET=release "$@" 5 | -------------------------------------------------------------------------------- /stack/build_win32.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set ROOT=%~pd0 3 | set OPENSSL_SOURCEDIR=%ROOT%openssl-1.0.?? 4 | set OPENSSL_INSTALDIR=%ROOT%openssl 5 | set MAKEFLAGS= 6 | 7 | if not "%1" == "" goto help 8 | 9 | call :testroot %ROOT% 10 | if errorlevel 1 goto error0 11 | 12 | nmake -? >NUL 2>&1 13 | if errorlevel 1 goto error1 14 | 15 | ml -? >NUL 2>&1 16 | if errorlevel 1 goto error1 17 | 18 | perl -v >NUL 2>&1 19 | if errorlevel 1 goto error2 20 | 21 | cd /D %OPENSSL_SOURCEDIR% >NUL 2>&1 22 | if errorlevel 1 goto error3 23 | 24 | perl Configure VC-WIN32 no-asm no-ec --prefix=%OPENSSL_INSTALDIR% 25 | if errorlevel 1 goto error 26 | 27 | sed -i "/perl/ s/\\\\/\\//g" ms/do_ms.bat 28 | call ms\do_ms 29 | if errorlevel 1 goto error 30 | 31 | sed -i "/PERL/ s/\\\\/\\//g; /PERL/ s/\\$@/\$(@:\\\\=\\/)/;" ms/nt*.mak 32 | nmake -f ms\nt.mak clean 33 | 34 | nmake -f ms\nt.mak 35 | if errorlevel 1 goto error 36 | 37 | nmake -f ms\nt.mak install 38 | if errorlevel 1 goto error 39 | 40 | :ossl_done 41 | cd ..\Stack 42 | if errorlevel 1 goto error 43 | 44 | nmake -f win32_msc.mak clean 45 | if errorlevel 1 goto error 46 | 47 | nmake -f win32_msc.mak 48 | if errorlevel 1 goto error 49 | 50 | cd .. 51 | goto done 52 | 53 | :ossl_build 54 | set CONFIGURE_INSIST=1 55 | set PERL=perl 56 | 57 | perl Configure VC-WIN32 no-shared no-asm no-ec no-autoload-config --prefix=%OPENSSL_INSTALDIR% --openssldir=%OPENSSL_INSTALDIR%\ssl 58 | if errorlevel 1 goto error 59 | 60 | nmake 61 | if errorlevel 1 goto error 62 | 63 | nmake install 64 | if errorlevel 1 goto error 65 | 66 | copy ..\openssl\lib\libcrypto.lib ..\openssl\lib\libeay32.lib 67 | copy ..\openssl\lib\libssl.lib ..\openssl\lib\ssleay32.lib 68 | goto ossl_done 69 | 70 | :testroot 71 | if "%1" == "%ROOT%" exit /B 0 72 | exit /B 1 73 | 74 | :error0 75 | echo fatal error: cannot continue. 76 | echo the directory %ROOT% must not contain blanks 77 | goto done 78 | 79 | :error1 80 | echo fatal error: cannot continue. 81 | echo this batch has to be called from a 82 | echo 32bit visual studio command shell 83 | goto done 84 | 85 | :error2 86 | echo fatal error: cannot continue. 87 | echo perl has to be in the path 88 | goto done 89 | 90 | :error3 91 | cd /D %ROOT%openssl-3.?.? >NUL 2>&1 92 | if not errorlevel 1 goto ossl_build 93 | goto error4 94 | 95 | :error4 96 | cd /D %ROOT%openssl-1.1.?? >NUL 2>&1 97 | if not errorlevel 1 goto ossl_build 98 | echo fatal error: cannot continue. 99 | echo openssl sources must be at %OPENSSL_SOURCEDIR% 100 | goto done 101 | 102 | :error 103 | echo fatal error: cannot continue. 104 | 105 | :help 106 | echo this batch has to be called from a 107 | echo 32bit visual studio command shell 108 | echo the directory %ROOT% must not contain blanks 109 | echo openssl sources must be at %OPENSSL_SOURCEDIR% 110 | echo perl has to be in the path 111 | 112 | :done 113 | -------------------------------------------------------------------------------- /stack/build_win64.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set ROOT=%~pd0 3 | set OPENSSL_SOURCEDIR=%ROOT%openssl-1.0.?? 4 | set OPENSSL_INSTALDIR=%ROOT%openssl 5 | set MAKEFLAGS= 6 | 7 | if not "%1" == "" goto help 8 | 9 | call :testroot %ROOT% 10 | if errorlevel 1 goto error0 11 | 12 | nmake -? >NUL 2>&1 13 | if errorlevel 1 goto error1 14 | 15 | ml64 -? >NUL 2>&1 16 | if errorlevel 1 goto error1 17 | 18 | perl -v >NUL 2>&1 19 | if errorlevel 1 goto error2 20 | 21 | cd /D %OPENSSL_SOURCEDIR% >NUL 2>&1 22 | if errorlevel 1 goto error3 23 | 24 | perl Configure VC-WIN64A no-ec --prefix=%OPENSSL_INSTALDIR% 25 | if errorlevel 1 goto error 26 | 27 | sed -i "/perl/ s/\\\\/\\//g" ms/do_win64a.bat 28 | call ms\do_win64a 29 | if errorlevel 1 goto error 30 | 31 | sed -i "/PERL/ s/\\\\/\\//g; /PERL/ s/\\$@/\$(@:\\\\=\\/)/;" ms/nt*.mak 32 | nmake -f ms\nt.mak clean 33 | 34 | nmake -f ms\nt.mak 35 | if errorlevel 1 goto error 36 | 37 | nmake -f ms\nt.mak install 38 | if errorlevel 1 goto error 39 | 40 | :ossl_done 41 | cd ..\Stack 42 | if errorlevel 1 goto error 43 | 44 | nmake -f win32_msc.mak clean 45 | if errorlevel 1 goto error 46 | 47 | nmake -f win32_msc.mak 48 | if errorlevel 1 goto error 49 | 50 | cd .. 51 | goto done 52 | 53 | :ossl_build 54 | set CONFIGURE_INSIST=1 55 | set PERL=perl 56 | 57 | perl Configure VC-WIN64A no-shared no-asm no-ec --prefix=%OPENSSL_INSTALDIR% --openssldir=%OPENSSL_INSTALDIR%\ssl 58 | if errorlevel 1 goto error 59 | 60 | nmake 61 | if errorlevel 1 goto error 62 | 63 | nmake install 64 | if errorlevel 1 goto error 65 | 66 | copy ..\openssl\lib\libcrypto.lib ..\openssl\lib\libeay32.lib 67 | copy ..\openssl\lib\libssl.lib ..\openssl\lib\ssleay32.lib 68 | goto ossl_done 69 | 70 | :testroot 71 | if "%1" == "%ROOT%" exit /B 0 72 | exit /B 1 73 | 74 | :error0 75 | echo fatal error: cannot continue. 76 | echo the directory %ROOT% must not contain blanks 77 | goto done 78 | 79 | :error1 80 | echo fatal error: cannot continue. 81 | echo this batch has to be called from a 82 | echo 64bit visual studio command shell 83 | goto done 84 | 85 | :error2 86 | echo fatal error: cannot continue. 87 | echo perl has to be in the path 88 | goto done 89 | 90 | :error3 91 | cd /D %ROOT%openssl-3.?.? >NUL 2>&1 92 | if not errorlevel 1 goto ossl_build 93 | goto error4 94 | 95 | :error4 96 | cd /D %ROOT%openssl-1.1.?? >NUL 2>&1 97 | if not errorlevel 1 goto ossl_build 98 | echo fatal error: cannot continue. 99 | echo openssl sources must be at %OPENSSL_SOURCEDIR% 100 | goto done 101 | 102 | :error 103 | echo fatal error: cannot continue. 104 | 105 | :help 106 | echo this batch has to be called from a 107 | echo 64bit visual studio command shell 108 | echo the directory %ROOT% must not contain blanks 109 | echo openssl sources must be at %OPENSSL_SOURCEDIR% 110 | echo perl has to be in the path 111 | 112 | :done 113 | -------------------------------------------------------------------------------- /stack/linux_gcc.mak: -------------------------------------------------------------------------------- 1 | # Copyright (c) 1996-2021, OPC Foundation. All rights reserved. 2 | # 3 | # The source code in this file is covered under a dual-license scenario: 4 | # - RCL: for OPC Foundation members in good-standing 5 | # - GPL V2: everybody else 6 | # 7 | # RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | # 9 | # GNU General Public License as published by the Free Software Foundation; 10 | # version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | # 12 | # This source code is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # generate Stack and Test Server 17 | 18 | # parameters: 19 | # BUILD_TARGET=debug|release 20 | # MACHINE_TYPE=x86_64|i386 21 | # MACHINE_OPT= 22 | 23 | all: 24 | $(MAKE) -C Stack -f linux_gcc.mak all 25 | 26 | clean: 27 | $(MAKE) -C Stack -f linux_gcc.mak clean 28 | 29 | strip: 30 | $(MAKE) -C Stack -f linux_gcc.mak strip 31 | -------------------------------------------------------------------------------- /stack/linux_gcc_rules.mak: -------------------------------------------------------------------------------- 1 | # Copyright (c) 1996-2021, OPC Foundation. All rights reserved. 2 | # 3 | # The source code in this file is covered under a dual-license scenario: 4 | # - RCL: for OPC Foundation members in good-standing 5 | # - GPL V2: everybody else 6 | # 7 | # RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | # 9 | # GNU General Public License as published by the Free Software Foundation; 10 | # version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | # 12 | # This source code is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | # 16 | # Global rules for all GCC builds 17 | 18 | CC = $(CROSS_COMPILE)gcc 19 | CXX = $(CROSS_COMPILE)g++ 20 | AR = $(CROSS_COMPILE)ar 21 | STRIP = $(CROSS_COMPILE)strip 22 | MKDIR = mkdir -p 23 | 24 | ifndef MACHINE_TYPE 25 | ifndef CROSS_COMPILE 26 | TMP_MACHINE_TYPE = $(shell uname -i) 27 | ifeq ($(TMP_MACHINE_TYPE),x86_64) 28 | MACHINE_TYPE = x86_64 29 | else 30 | ifeq ($(TMP_MACHINE_TYPE),i386) 31 | MACHINE_TYPE = i386 32 | else 33 | ifeq ($(TMP_MACHINE_TYPE),i686) 34 | MACHINE_TYPE = i386 35 | else 36 | MACHINE_TYPE = unknown 37 | endif 38 | endif 39 | endif 40 | else 41 | MACHINE_TYPE = unknown 42 | endif 43 | endif 44 | 45 | ifndef MACHINE_OPT 46 | ifndef CROSS_COMPILE 47 | ifeq ($(MACHINE_TYPE),x86_64) 48 | MACHINE_OPT = -m64 49 | else 50 | ifeq ($(MACHINE_TYPE),i386) 51 | MACHINE_OPT = -m32 52 | endif 53 | endif 54 | endif 55 | endif 56 | 57 | BIN_PATH = linux/$(MACHINE_TYPE) 58 | 59 | ifndef BUILD_TARGET 60 | BUILD_TARGET = release 61 | endif 62 | 63 | ifeq ($(findstring debug,$(BUILD_TARGET)),debug) 64 | EXTRA_CFLAGS = -D_DEBUG -g $(MACHINE_OPT) 65 | else 66 | EXTRA_CFLAGS = -O3 $(MACHINE_OPT) 67 | endif 68 | -------------------------------------------------------------------------------- /strlcat.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | /** Size limited concatenate string function. 21 | * This function guaranties that \c dst will be zero terminated, 22 | * as long as \c dst is at least one byte long. 23 | * Note that strlcpy works on true 'C' strings, which means 24 | * both \c src and \c dst must be zero terminated. 25 | * If \c len <= strlen(dst) strlcat cannot write any characters, 26 | * strlen(dst) will be returned. 27 | * @param dst destination buffer 28 | * @param src source buffer 29 | * @param len length of destination 30 | * @return total length of the created string in \c dst 31 | */ 32 | size_t strlcat(char *dst, const char *src, size_t len) 33 | { 34 | size_t pos = strlen(dst); 35 | if (len <= pos) return pos; /* sanity check */ 36 | len--; /* reserve space for null terminator */ 37 | 38 | while (pos < len && *src) 39 | { 40 | dst[pos++] = *src; 41 | src++; 42 | } 43 | dst[pos] = 0; 44 | return pos; 45 | } 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /strlcpy.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | /** Size limited copy string function. 21 | * This function guaranties that \c dst will be zero terminated, 22 | * as long as \c dst is at least one byte long. 23 | * Note that strlcpy works on true 'C' strings, which means 24 | * both \c src and \c dst must be zero terminated. 25 | * @param dst destination buffer 26 | * @param src source buffer 27 | * @param len length of destination 28 | * @return total length of the created string in \c dst 29 | */ 30 | size_t strlcpy(char *dst, const char *src, size_t len) 31 | { 32 | size_t pos = 0; 33 | if (len < 1) return 0; /* sanity check */ 34 | len--; /* reserve space for null terminator */ 35 | 36 | while (pos < len && *src) 37 | { 38 | dst[pos++] = *src; 39 | src++; 40 | } 41 | dst[pos] = 0; 42 | return pos; 43 | } 44 | 45 | 46 | -------------------------------------------------------------------------------- /ualds.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __UALDS_H__ 18 | #define __UALDS_H__ 19 | 20 | /** UA LDS Endpoint configuration structure. 21 | * Unlike the OpcUa_EndpointDescription this is a technical configuration, 22 | * which defines endpoint = url = IP/port combination, which is required 23 | * for creating the sockets. 24 | * OpcUa_EndpointDescription defines one endpoint to be the combination 25 | * of one url + one security configuration + one messagemode. This requires 26 | * to create individual endpoints for each permutation of url and security configurations. 27 | * (complete nonesense!). 28 | */ 29 | struct _ualds_endpoint 30 | { 31 | char szUrl[UALDS_CONF_MAX_URI_LENGTH]; 32 | OpcUa_UInt32 nNoOfSecurityPolicies; 33 | OpcUa_Endpoint_SecurityPolicyConfiguration *pSecurityPolicies; 34 | OpcUa_Endpoint hEndpoint; /**< handle of open endpoint */ 35 | }; 36 | typedef struct _ualds_endpoint ualds_endpoint; 37 | 38 | typedef struct _multicastSocketCallbackStruct 39 | { 40 | OpcUa_Void* sdRef; 41 | OpcUa_Void* context; 42 | } MulticastSocketCallbackStruct; 43 | 44 | extern OpcUa_Mutex g_mutex; 45 | extern int g_bEnableZeroconf; 46 | 47 | void ualds_endpoint_initialize(ualds_endpoint *pEndpoint); 48 | void ualds_endpoint_clear(ualds_endpoint *pEndpoint); 49 | 50 | int ualds_server(); 51 | void ualds_shutdown(); 52 | void ualds_reload(); 53 | void ualds_expirationcheck(); 54 | 55 | const ualds_endpoint* ualds_endpoints(OpcUa_UInt32 *pNumEndpoints); 56 | const char* ualds_serveruri(); 57 | const char* ualds_producturi(); 58 | const char* ualds_applicationname(const char *szLocale); 59 | 60 | // param flush 61 | // != 0 => flush to disk 62 | // == 0 => don't flush to disk 63 | int ualds_settings_cleanup(int flush); 64 | 65 | /*============================================================================ 66 | * Helper Macro For Building Response Header 67 | *===========================================================================*/ 68 | #define UALDS_BUILDRESPONSEHEADER \ 69 | pResponse->ResponseHeader.Timestamp = OpcUa_DateTime_UtcNow(); \ 70 | pResponse->ResponseHeader.RequestHandle = pRequest->RequestHeader.RequestHandle;\ 71 | pResponse->ResponseHeader.ServiceResult = uStatus;\ 72 | uStatus = OpcUa_Good 73 | 74 | #endif /* __UALDS_H__ */ 75 | -------------------------------------------------------------------------------- /utils.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef UTILS 18 | #define UTILS 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | OpcUa_StatusCode ualds_parse_url(char *szUrl, char **szScheme, char **szHostname, uint16_t *port, char **szPath); 25 | int is_Host_IP4Address(const char* host); 26 | int isTLD(char* domain); 27 | void loadKnownTLD(); 28 | 29 | #endif /* UTILS */ -------------------------------------------------------------------------------- /win32/certstore.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __CERTSTORE_H__ 18 | #define __CERTSTORE_H__ 19 | 20 | #include 21 | 22 | OpcUa_StatusCode ualds_verify_cert_win32(OpcUa_ByteString* pbsClientCertificate); 23 | 24 | // the below checks are for backward compatibility woth older LDS versions 25 | OpcUa_StatusCode ualds_verify_cert_old_default_location(OpcUa_ByteString* pbsClientCertificate, char* newCertificateStorePathCrl, 26 | char* newCertificateStorePathRejected, OpcUa_Int* pValidationCode); 27 | OpcUa_StatusCode ualds_verify_cert_old_edited_location(OpcUa_ByteString* pbsClientCertificate, char* newCertificateStorePathCrl, 28 | char* newCertificateStorePathRejected, char* trustListPathOldEditedLocation, OpcUa_Int* pValidationCode); 29 | 30 | #endif /* __CERTSTORE_H__ */ 31 | -------------------------------------------------------------------------------- /win32/daemon.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | /* system includes */ 18 | #include 19 | /* uastack includes */ 20 | #include 21 | /* local platform includes */ 22 | #include 23 | /* locale includes */ 24 | #include "../config.h" 25 | #include "../ualds.h" 26 | #include "service.h" 27 | #include "log.h" 28 | 29 | BOOL CtrlHandler(DWORD dwCtrlType) 30 | { 31 | switch (dwCtrlType) 32 | { 33 | case CTRL_C_EVENT: 34 | ualds_log(UALDS_LOG_NOTICE, "Received CTRL_C_EVENT. Terminating now."); 35 | ualds_shutdown(); 36 | return TRUE; 37 | case CTRL_CLOSE_EVENT: 38 | ualds_log(UALDS_LOG_NOTICE, "Received CTRL_CLOSE_EVENT. Terminating now."); 39 | ualds_shutdown(); 40 | return TRUE; 41 | case CTRL_BREAK_EVENT: 42 | ualds_log(UALDS_LOG_NOTICE, "Received CTRL_BREAK_EVENT. Terminating now."); 43 | ualds_shutdown(); 44 | return TRUE; 45 | case CTRL_SHUTDOWN_EVENT: 46 | ualds_log(UALDS_LOG_NOTICE, "Received CTRL_SHUTDOWN_EVENT. Terminating now."); 47 | ualds_shutdown(); 48 | return TRUE; 49 | default: 50 | return FALSE; 51 | } 52 | } 53 | 54 | static void install_signal_handlers() 55 | { 56 | if (SetConsoleCtrlHandler((PHANDLER_ROUTINE)CtrlHandler, TRUE)) 57 | { 58 | ualds_log(UALDS_LOG_INFO, "Installed Control Handler."); 59 | } 60 | else 61 | { 62 | ualds_log(UALDS_LOG_ERR, "Installing Control Handler failed."); 63 | } 64 | } 65 | 66 | /** Starts the windows service and returns. */ 67 | int daemonize() 68 | { 69 | BOOL bRet; 70 | SERVICE_TABLE_ENTRY dispatchTable[] = 71 | { 72 | { UALDS_CONF_SERVICE_NAME, ServiceMain }, 73 | { NULL, NULL } 74 | }; 75 | 76 | bRet = StartServiceCtrlDispatcher(dispatchTable); 77 | if (bRet) 78 | { 79 | fprintf(stdout, "Successfully started service."); 80 | } 81 | else 82 | { 83 | TCHAR szMessage[100]; 84 | DWORD err = GetLastError(); 85 | ualds_platform_errorstring(err, szMessage, sizeof(szMessage)); 86 | _ftprintf(stderr, _T("Error: Starting service '%s' failed with error(%i): %s.\n"), UALDS_CONF_SERVICE_NAME, err, szMessage); 87 | } 88 | 89 | return bRet == TRUE ? 0 : 1; 90 | } 91 | 92 | /** just runs the application without daemonizing. */ 93 | int run() 94 | { 95 | install_signal_handlers(); 96 | return ualds_server(); 97 | } 98 | 99 | -------------------------------------------------------------------------------- /win32/daemon.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __DAEMON_H__ 18 | #define __DAEMON_H__ 19 | 20 | #include "service.h" 21 | 22 | int daemonize(); 23 | int run(); 24 | 25 | #endif /* __DAEMON_H__ */ 26 | -------------------------------------------------------------------------------- /win32/getopt.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | /* Windows has not getopt() so we implement our own simple version. 18 | * Unlike real getopt() implementation this version can only parse short option names. 19 | */ 20 | #include 21 | #include 22 | 23 | char *optarg = NULL; /* Global argument pointer. */ 24 | int optind = 0; /* Global argv index. */ 25 | static char *scan = NULL; /* Private scan pointer. */ 26 | 27 | int getopt(int argc, char *argv[], char *optstring) 28 | { 29 | char c = '\0'; 30 | char *place = NULL; 31 | 32 | optarg = NULL; 33 | 34 | if (scan == NULL || *scan == '\0') 35 | { 36 | if (optind == 0) 37 | { 38 | optind++; 39 | } 40 | 41 | if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') 42 | { 43 | return EOF; 44 | } 45 | 46 | if (strcmp(argv[optind], "--") == 0) 47 | { 48 | optind++; 49 | return EOF; 50 | } 51 | 52 | scan = argv[optind] + 1; 53 | optind++; 54 | } 55 | 56 | c = *scan++; 57 | place = strchr(optstring, c); 58 | 59 | if (place == NULL || c == ':') 60 | { 61 | fprintf(stderr, "%s: unknown option -%c\n", argv[0], c); 62 | return '?' ; 63 | } 64 | 65 | place++; 66 | 67 | if (*place == ':') 68 | { 69 | if (*scan != '\0') 70 | { 71 | optarg = scan; 72 | scan = NULL; 73 | } 74 | else if (optind < argc) 75 | { 76 | optarg = argv[optind]; 77 | optind++; 78 | } 79 | else 80 | { 81 | fprintf(stderr, "%s: -%c argument missing\n", argv[0], c); 82 | return '?'; 83 | } 84 | } 85 | 86 | return c; 87 | } 88 | 89 | -------------------------------------------------------------------------------- /win32/getopt.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __WINGETOPT_H__ 18 | #define __WINGETOPT_H__ 19 | 20 | extern char *optarg; /* Global argument pointer. */ 21 | extern int optind; /* Global argv index. */ 22 | 23 | int getopt(int argc, char *argv[], char *optstring); 24 | 25 | #endif /* __WINGETOPT_H__ */ 26 | -------------------------------------------------------------------------------- /win32/log.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __LOG_H__ 18 | #define __LOG_H__ 19 | 20 | enum _LogTarget 21 | { 22 | UALDS_LOG_SYSLOG = 0, /**< uses system log for logging */ 23 | UALDS_LOG_STDERR, /**< prints log messages to stderr (Makes only sense with -d option) */ 24 | UALDS_LOG_FILE /**< logs into a custom file */ 25 | }; 26 | typedef enum _LogTarget LogTarget; 27 | 28 | enum _LogLevel 29 | { 30 | UALDS_LOG_EMERG = 0, /**< system is unusable */ 31 | UALDS_LOG_ALERT, /**< action must be taken immediately */ 32 | UALDS_LOG_CRIT, /**< critical conditions */ 33 | UALDS_LOG_ERR, /**< error conditions */ 34 | UALDS_LOG_WARNING, /**< warnings conditions */ 35 | UALDS_LOG_NOTICE, /**< normal, but significant, condition */ 36 | UALDS_LOG_INFO, /**< informational message */ 37 | UALDS_LOG_DEBUG /** debug-level message */ 38 | }; 39 | typedef enum _LogLevel LogLevel; 40 | 41 | int ualds_openlog(LogTarget target, LogLevel level); 42 | void ualds_log(LogLevel level, const char *format, ...); 43 | void ualds_closelog(); 44 | 45 | #endif /* __LOG_H__ */ 46 | -------------------------------------------------------------------------------- /win32/service.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __SERVICE_H__ 18 | #define __SERVICE_H__ 19 | 20 | /* system includes */ 21 | #include 22 | 23 | void WINAPI ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv); 24 | BOOL StartBonjourService(); 25 | int ServiceRegister(); 26 | int ServiceUnregister(); 27 | int ServiceStart(); 28 | int ServiceStop(); 29 | int ServiceStatus(); 30 | 31 | #endif /* __SERVICE_H__ */ -------------------------------------------------------------------------------- /win32/ualds.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OPCFoundation/UA-LDS/afca39ae449a7e505ff1295fab23a7df851ca9ae/win32/ualds.ico -------------------------------------------------------------------------------- /win32/version.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | 4 | IDI_ICON1 ICON DISCARDABLE "ualds.ico" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "windows.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | // include version info defines 17 | #include "win_version.h" 18 | 19 | ///////////////////////////////////////////////////////////////////////////// 20 | // English (United States) resources 21 | 22 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 23 | LANGUAGE 9, 1 24 | 25 | VS_VERSION_INFO VERSIONINFO 26 | FILEVERSION VER_FILE_VERSION 27 | PRODUCTVERSION VER_PRODUCTVERSION 28 | FILEFLAGSMASK 0x3fL 29 | #ifdef _DEBUG 30 | FILEFLAGS 0x1L 31 | #else 32 | FILEFLAGS 0x0L 33 | #endif 34 | FILEOS 0x40004L 35 | FILETYPE 0x2L 36 | FILESUBTYPE 0x0L 37 | BEGIN 38 | BLOCK "StringFileInfo" 39 | BEGIN 40 | BLOCK "000004b0" 41 | BEGIN 42 | VALUE "Comments", "UA Local Discovery Server\0" 43 | VALUE "CompanyName", "OPC Foundation" 44 | VALUE "FileDescription", "UA Local Discovery Server Windows Service\0" 45 | #ifdef _DEBUG 46 | VALUE "FileVersion", VER_FILE_VERSION_STR "(Debug Build)\0" 47 | #else 48 | VALUE "FileVersion", VER_FILE_VERSION_STR "(Release Build)\0" 49 | #endif 50 | VALUE "InternalName", "UALDS\0" 51 | VALUE "LegalCopyright", "Copyright (C) 2024, OPC Foundation" 52 | VALUE "LegalTrademarks", "" 53 | VALUE "OriginalFilename", "opcualds.exe\0" 54 | VALUE "PrivateBuild", "\0" 55 | VALUE "ProductName", "UA Local Discovery Server" 56 | VALUE "ProductVersion", VER_PRODUCTVERSION_STR "\0" 57 | END 58 | END 59 | BLOCK "VarFileInfo" 60 | BEGIN 61 | VALUE "Translation", 0x0000, 1200 62 | END 63 | END 64 | 65 | #endif // English (United States) resources 66 | ///////////////////////////////////////////////////////////////////////////// 67 | 68 | 69 | -------------------------------------------------------------------------------- /win32/win_version.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual - license scenario : 4 | -RCL : for OPC Foundation members in good - standing 5 | - GPL V2 : everybody else 6 | 7 | RCL license terms accompanied with this source code.See http ://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code.See http ://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include "../config.h" 18 | 19 | #define VER_FILE_VERSION UALDS_CONF_VERSION_MAJOR,UALDS_CONF_VERSION_MINOR,UALDS_CONF_VERSION_PATCH,UALDS_CONF_VERSION_BUILD 20 | #define VER_PRODUCTVERSION UALDS_CONF_VERSION_MAJOR,UALDS_CONF_VERSION_MINOR,UALDS_CONF_VERSION_PATCH,UALDS_CONF_VERSION_BUILD 21 | #define VER_FILE_VERSION_STR "V" UALDS_CONF_VERSION_STRING 22 | #define VER_PRODUCTVERSION_STR "V" UALDS_CONF_VERSION_STRING 23 | -------------------------------------------------------------------------------- /win32/winmain.c: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual-license scenario: 4 | - RCL: for OPC Foundation members in good-standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #include 18 | #include "../config.h" 19 | #include "platform.h" 20 | 21 | extern int main(int argc, char* argv[]); 22 | 23 | /* On Windows we need this special main entry function when compiling 24 | * with subsystem:windows. 25 | * This function is only a wrapper and will call the standard C main(). 26 | */ 27 | int WINAPI WinMain( 28 | HINSTANCE hInstance, 29 | HINSTANCE hPrevInstance, 30 | LPSTR lpCmdLine, 31 | int nCmdShow) 32 | { 33 | UALDS_UNUSED(hInstance); 34 | UALDS_UNUSED(hPrevInstance); 35 | UALDS_UNUSED(lpCmdLine); 36 | UALDS_UNUSED(nCmdShow); 37 | /* Call standard C main() function. 38 | * Luckily MS as defined the original parameters as undocumented feature: 39 | * __argc and __argv 40 | */ 41 | return main(__argc, __argv); 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /zeroconf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1996-2024, OPC Foundation. All rights reserved. 2 | 3 | The source code in this file is covered under a dual - license scenario : 4 | - RCL: for OPC Foundation members in good - standing 5 | - GPL V2: everybody else 6 | 7 | RCL license terms accompanied with this source code.See http ://opcfoundation.org/License/RCL/1.00/ 8 | 9 | GNU General Public License as published by the Free Software Foundation; 10 | version 2 of the License are accompanied with this source code.See http ://opcfoundation.org/License/GPLv2 11 | 12 | This source code is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 | */ 16 | 17 | #ifndef __ZEROCONF_H__ 18 | #define __ZEROCONF_H__ 19 | 20 | #include 21 | 22 | OpcUa_StatusCode ualds_zeroconf_start_registration(); 23 | void ualds_zeroconf_stop_registration(); 24 | 25 | void ualds_zeroconf_addRegistration(const char *szServerUri); 26 | void ualds_zeroconf_removeRegistration(const char *szServerUri); 27 | 28 | void ualds_zeroconf_socketEventCallback(int* shutdown); 29 | 30 | #endif /* __ZEROCONF_H__ */ 31 | --------------------------------------------------------------------------------