Commit Graph
43 Commits
Author SHA1 Message Date
Sten Grüner 1de8b24ac0 First attempt of mDNS interface selection (#2856)
fixes #2774
2019-07-02 17:16:02 +02:00
Stefan Profanter 6fe8453249 Untabify
Used command:
`find . \( -name '*.c' -o -name '*.h' \) -not \( -path "./deps/*" -prune \) ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;`
2019-05-25 09:09:46 +02:00
Stefan Profanter d419a00a6b Stack: Add additional config flag to enable mDNS and fix UaExpert not showing LDS Server 2019-05-06 18:05:09 +02:00
Stefan Profanter f2a151bc01 Stack: Refactor server config to separated discovery and mDNS settings 2019-05-06 18:05:09 +02:00
Stefan Profanter 4a9bcf38c0 Stack: Add support for dynamic port assigning
Fixes #2416
2019-05-06 09:33:15 +02:00
Julius Pfrommer fd08d012d9 Server: Initialize the config in the server 2019-04-23 00:41:32 +02:00
Stefan Profanter 63f3653ff1 Additional header cleanup and consistent name of ns generated files 2019-03-21 20:16:31 +01:00
Julius Pfrommer c9c818868f Move header files to a more unix-like structure
This commit drops the 'ua_' prefix and changes the public includes
to the form `#include <open62541/server.h>` instead of the old
`#include <ua_server.h>`
2019-03-21 20:16:31 +01:00
Stefan Profanter f295562a11 Untabify
Used command:
`find . \( -name '*.c' -o -name '*.h' \) -not \( -path "./deps/*" -prune \) ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;`
2019-03-14 16:44:34 +01:00
Frank Meerkoetter 1648fb8aaa Use EXIT_SUCCESS/FAILURE for the examples
Make use of EXIT_SUCCESS and EXIT_FAILURE from stdlib.h.
The previous approach of returning a value from UA_StatusCode
was often broken as an exit code can (portably) only be between 0 and 125.
2019-02-09 09:34:46 +01:00
Frank Meerkoetter 9b9ecfee5d Resolve port conflict
Registering server complains that the port 4840 is already in use (as the LDS is
running there).

./discovery_server_register
[...]
[2019-02-04 22:45:20.070 (UTC+0100)] info/userland      Node read the.answer
[2019-02-04 22:45:20.070 (UTC+0100)] info/userland      read value 42
[2019-02-04 22:45:20.070 (UTC+0100)] warn/network       Error binding a server socket: Address already in use
[2019-02-04 22:45:20.070 (UTC+0100)] warn/network       Error binding a server socket: Address already in use
[2019-02-04 22:45:20.070 (UTC+0100)] info/network       TCP network layer listening on opc.tcp://prokyon:4840/
2019-02-06 11:58:17 +01:00
Frank Meerkoetter ba2616e0f1 Spelling and whitespace fixes 2019-02-05 07:58:15 +01:00
Julius Pfrommer bcaa6695c0 Client: Store SecurityPolicies in the client config; Refactor connection logic 2019-01-30 18:45:42 +01:00
Julius Pfrommer b4c9fc37eb Client: Initialize client config inside the client structure
Temporarily disable encyrption
2019-01-30 18:45:42 +01:00
Stefan Profanter d715db1057 Stack: Use non-amalgamated headers in all the examples
For consistency we recommend using non-amalgamation install, thus the
examples should also use the non-amalgamated headers.
2018-12-17 22:40:07 +01:00
Stefan Profanter 0c62edab47 Avoid MinGW warning unknown conversion type character 'z' in format 2018-12-17 22:35:55 +01:00
Julius Pfrommer eb9409b435 Examples: Use _clear instead of _deleteMembers for the examples 2018-12-09 19:40:02 +01:00
Julius Pfrommer 89f728aee1 Logging: Make logging a proper plugin with state and cleanup method 2018-12-04 18:39:12 +01:00
Jose Cabral 1605455a74 Fixes #1925 and clean examples 2018-07-25 08:17:51 +02:00
Stefan Profanter 473c0e960b Use hostname resolving to correctly handle mDNS SRV target announces 2018-07-16 11:59:22 +02:00
Stefan Profanter b6b58a8ea2 Use correct format specifier 2018-07-11 14:21:30 +02:00
StalderT 047c5e4098 WIP client : timed async service & async highlevel functions with client worker for 0.4 (#1598)
This commit adds asynchronous services to open62541 on client side

* Asynchronous service (highlevel read/write) are available through the API that is defined in
ua_client_highlevel_async.h

* Besides the services, the connection procedure is asynchronous as well.

* A client Application that uses the asynchronous API 
adds requests by calling an asynchronous service (e.g., UA_Client_sendAsyncReadRequest(), UA_Client_sendAsyncBrowseRequest() )
checks for response with UA_Client_run_iterate() repeatedly
and processes the responses with user-defined callbacks
2018-05-15 10:54:15 +02:00
StalderT da64add5c0 client basic 256sha256 / server sample / tests / various fixes (#1691)
* client basic 256sha256 / tests / various fixes

* fix server basic256sha256

* remove duplicated loadFile

* Fix fuzzing by making backup of message buffer

* Disable sonarcloud on PRs
2018-03-29 19:15:20 +02:00
Stefan Profanter dd9696dede Support OPC Foundation LDS server
Since client encryption landed into master, this was an open todo for
a long time. The multicast server example was updated to use the encryption
client.

Fixes #938
2018-03-28 23:41:09 +02:00
StalderT 7e30f66b0b fix if/while/for/switch typo 2018-01-22 22:00:55 +01:00
Stefan Profanter 2c62703613 Fix #1360 socket error messages and mDNS socket on windows 2017-11-19 10:44:57 +01:00
Julius Pfrommer e2fbdeab5c fix a gcc-7 warning 2017-09-11 19:51:04 +02:00
Stefan Profanter 61f5018854 Merge remote-tracking branch 'upstream/master' into hotfix/localeid
# Conflicts:
#	examples/client.c
#	examples/discovery/server_multicast.c
#	examples/discovery/server_register.c
#	examples/server.c
#	examples/server_inheritance.c
#	examples/tutorial_server_datasource.c
#	examples/tutorial_server_variabletype.c
2017-09-07 10:28:44 +02:00
Julius Pfrommer 215b077f57 use _default attributes in all examples 2017-09-06 01:08:05 +02:00
Jonas Green 7a58e6c0a5 Corrected format of LocaleId in LocalizedText attributes
The LocaleIds was formatted with an underscore as separator between
the language and region. According to the OPC UA specification the
language and the region shall be separated by a hyphen.
Also removed LocaleId in those cases where a specific language is not
addressed, i.e. when presenting a type name.
2017-08-29 10:08:15 +02:00
Julius Pfrommer 394df3be8d finish nodeContext pointer for every node 2017-08-18 15:00:00 +02:00
Infinity95 a8012d3040 endpoints in the server config; new/delete functions for the server config 2017-08-15 09:52:34 +02:00
Julius Pfrommer 934496a84a add printf-format function attributes for gcc; fix all logging warnings 2017-08-06 13:24:53 +02:00
Stefan Profanter 369103e793 Use proper defines for malloc, free, calloc, realloc 2017-07-21 15:39:17 +02:00
Julius Pfrommer 5398343607 enable even stricter compiler warnings; test for C++ compat 2017-07-19 17:33:09 +02:00
Julius Pfrommer 1969bad066 remove public ua_job.h; call message processing from the network layer 2017-06-29 12:12:05 +02:00
Stefan Profanter 14df336430 Code review: @Pro's MDNS implementation (#732)
* Service RegisterServer and Discovery (#687)

* New RegisterServer service

Add support for Discovery Server (LDS/GDS) by providing RegisterServer service.
FindServers service is updated to return the registered servers.

* Add examples for discovery server

* Use compile switch for LDS

* Use periodic jobs for server register

* Add lastSeen for registered servers and fix compilation errors

* Add cleanup of stale registrations

* Fix UA_string output with printf (use `%.*s`)

* Use correct port number

* LDS customizable timeout for automatic de-register (#695)

* Enable valgrind for unit tests and fix memory leaks

* Fix build errors introduced by cmake rewrite in current master

* LDS customizable timeout for automatic de-register

* LDS-ME (using mDNS) (#730)

* Enable coveralls for Pro/open62541

* Move periodic server register functionality into core implementation

* Add mDNS library as dependency

* Cleanup and enable Mingw x64 on Appveyor

* Set define for mDNS dll

* Fix memory leak

* Check for defined variable to aviod deleting root dir

* Add LDS-ME

LDS Multicast Extension using mDNS for service discovery according to OPC UA Part 12
To be implemented:
- RegisterServer2
- FindServersOnNetwork
- GDS has to call FindServers on all known LDS

* Update to most recent schema definition from https://opcfoundation.org/UA/schemas/Opc.Ua.Types.bsd.xml

* Update to most recent node ids from https://opcfoundation.org/UA/schemas/NodeIds.csv

* Implement RegisterServer2 and FindServersOnNetwork

* Fix memory leak

* Use clang-3.7 because older scan build finds invalid bug

* Fix for mDNS class comparison if value is signed

* cosmetic cleanup (untabify, indention)

* fix after rebase

* Use monotonic clock for timeouts

* Fix crash of register server caused by invalid memory

* Set correct job id for periodic server register

* Use valid SD DNS name ([servername]._opcua-tcp._tcp.[hostname]. -> [servername]-[hostname]._opcua-tcp._tcp.local.)
Set A record for SD DNS

* Remove output of last seen time, since it is now monotonic and thus not human readable

* Fix removal of all remaining DNS records

* Fix discovery test due to previous changes

* Get interface ip addresses for windows

* Update mdnsd submodule

* Additional check output

* Also set A record for hostname

* Send multicast query to _opcua-tcp._tcp.local to find other servers after startup

* Update mdnsd

* Update mdnsd

* Limit mDNS label to max 63 chars according to DNS RFC

* Fix rebase issues

* fix a cppcheck issue for unreachable code

* Untabify

* Check if path or caps is set in TXT record

* Do not remove (TTL=0) `_services._dns-sd._udp.local.` because it may still be used by other PC in the net.

* Update mdnsd

* Fix correct construction of hostname if it is shorter than 63 chars

* Fix correct construction of hostname if it is shorter than 63 chars

* fixup

* Fix correct construction of hostname if it is shorter than 63 chars

* fixup

* Fix correct construction of hostname if it is shorter than 63 chars

* Fix correct construction of hostname if it is shorter than 63 chars

* fixup

* RegisterServer does not require a session

* untabify where it lead to compiler-warnings (if-guards)

* Update mdnsd

* Allow changing the LDS URL for RegisterServer and set default value if NULL

* Typo

* add Callbacks for RegisterServer and mDNS detection

* untabify

* Setting correct port for DiscoveryServer using NetworkLayer information. Better use of UA_EndpointUrl_split

* Include isTxtReceived parameter in callback

* Fix access after free

* Add EndpointUrl to CreateSessionRequest

* Copy&Paste error

* Fix #769: Wrong NodeIDs offset for BinaryEncoding

* fixup

* Fix #769: Wrong NodeIDs offset for BinaryEncoding

* Add additional node ids for previous change of binary encoding offset

* Also check for UA_STATUSCODE_BADSERVICEUNSUPPORTED

* Check correct response code

* Avoid double loops for finding correct node id

* Remove findDataType

* Disable xmlEncodingId for now

* Use UA_UInt64 for repeated job interval

UA_UInt32 for interval in nsec means maximum interval of 429 seconds -> too small

* Fix conversion to UInt64

* Move SplitEndoint into ua_connection.h

* Create specific method for splitting endpoint url. Fix #778

* Windows wants strncpy_s

* Port is max 6 chars

* Fix uninitialized parameter warning

* Handle path without leading slash

* Additional unit tests to cover discovery functionalities

* Untabify

* Fix broken build after merge

* Fix after merge

* fix after merge

* fix after merge

* Removed undef SLIST

* Readd missing BSD_SOURCE define needed for mdns

* Use correct define for amalgamation

* Add missing header for cygwin on Windows

* Fix compilation errors on windows using Visual Studio

* Fix double free

* If applicationType is set to DiscoveryServer, set it to Server

See http://forum.unified-automation.com/topic1987.html

* Fixup for merge

* fix output of UA_String

* Small bug fixes

* Fixup after merge

* Fixup 2 after merge

* Add missing library if win32 compile

* Delete server after test

* Fix wrong positive clang warnings

* Add additional assert for NULL

* Add additional assert for NULL

* Fix MS build

* Additional NULL check for clang analyzer

* Fix MS Build

* Fix #950 wrong requestServer structure passed to registerServer callback.

Thanks @XB32Z

* Reintegrate concepts of PR #932 which were removed in previous merge

Don't copy elements for RegisterServer call

* Fix build on appveyor

* Update mdns

* make mdns non-default; cosmetic improvements

* Enable discovery for unit tests

* Fix missing semicolon

* Travis fold log

* Travis fold log

* Avoid variable exit of local scope

* Refactor: move mdns functions into separate header

* Refactor: simplify and extract functions

* Add UA_ENABLE_DISCOVERY_SEMAPHORE to disable semaphore support on emedded devices

* Fix bug introduced in commit 83edcef3c1

* Enable mdns for unit tests

* Cleaner travis outpu and build separation

* Untabify

Command used:
`find . \( -name '*.c' -o -name '*.h' \) -not \( -path "./deps/*" -prune \) ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;`

* Untabify master

Command used:
`find . \( -name '*.c' -o -name '*.h' \) -not \( -path "./deps/*" -prune \) ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;`

* Untabify

Command used:
`find . \( -name '*.c' -o -name '*.h' \) -not \( -path "./deps/*" -prune \) ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;`

* Client must not create a session for FindServer calls.

Non-Multicast functionalities tested with OPC Foundation LDS Server. Fix #938

* Fix memleak

* Use correct uri

* untabify

* merge changes by @Pro

* split out mdns service functionality into separate file

* make local functions static

* split a large function, mark malloc that needs to be return-checked

* split large functions

* Return valid status code

* Add service description

* untabify

* Update mdns library

* Split loop into separate function

* Split overlong line

* Use correct define

* Fix build on VS2008

* fixup merge

* fixup merge

* Fix build on VS 2008

* Hide no_session connect for cleaner public api
2017-03-07 23:10:22 +01:00
Julius Pfrommer 08ee0a53f2 untabify master 2017-02-23 09:51:48 +01:00
Julius Pfrommer ce6f56c348 use amalgamated header for the examples 2017-02-09 23:07:10 +01:00
Julius Pfrommer 7aa39e4a31 fix remaining issues with g++; all examples compile as C++ 2017-01-13 12:08:28 +01:00
Stefan Profanter 658d85d451 LDS customizable timeout for automatic de-register (#695)
* Enable valgrind for unit tests and fix memory leaks

* Fix build errors introduced by cmake rewrite in current master

* LDS customizable timeout for automatic de-register
2016-07-18 18:12:08 +02:00
Stefan Profanter b851cfa2c0 Fix memory leaks found by valgrind (#696) 2016-07-17 10:11:45 +02:00
Stefan Profanter e9e68a0ba2 Service RegisterServer and Discovery (#687)
* New RegisterServer service

Add support for Discovery Server (LDS/GDS) by providing RegisterServer service.
FindServers service is updated to return the registered servers.

* Add examples for discovery server

* Use compile switch for LDS

* Use periodic jobs for server register

* Add lastSeen for registered servers and fix compilation errors

* Add cleanup of stale registrations

* Fix UA_string output with printf (use `%.*s`)

* Use correct port number
2016-07-14 16:27:13 +02:00