From 52727a053c45f8d6c634d405742c3289a0be1f78 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Wed, 18 Feb 2026 23:36:35 +0100 Subject: Rename CMake project and executable targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Project: OpcUaC → BobinkOpcUaC Targets: ServerLDS → bobink_opcua_discovery_server, ServerRegister → bobink_opcua_server, Client → client --- CMakeLists.txt | 21 +++++++++++---------- readme.md | 18 +++++++++--------- tests/run_cert_bootstrap_test.sh | 18 +++++++++--------- tests/run_download_cert_test.sh | 6 +++--- tests/run_test.sh | 14 +++++++------- 5 files changed, 39 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77d4ffb..a3a43f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,15 +2,16 @@ # OPC UA Discovery — Top-level build # ====================================== # -# Builds three programs that demonstrate OPC UA discovery. ServerLDS runs a -# Local Discovery Server. ServerRegister periodically registers itself with the -# LDS. Client queries servers for discovery info, endpoints, or current time. +# Builds three programs that demonstrate OPC UA discovery. +# bobink_opcua_discovery_server runs a Local Discovery Server. +# bobink_opcua_server periodically registers itself with the LDS. client +# queries servers for discovery info, endpoints, or current time. # # All programs link against common (shared helpers and config parser) which in # turn depends on open62541. cmake_minimum_required(VERSION 4.0) -project(OpcUaC C) +project(BobinkOpcUaC C) set(CMAKE_C_STANDARD 11) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) @@ -27,16 +28,16 @@ add_library(common STATIC src/common.c src/config.c) target_link_libraries(common open62541::open62541) # Unified client: find-servers, get-endpoints, read-time. -add_executable(Client src/client.c) -target_link_libraries(Client common) +add_executable(client src/client.c) +target_link_libraries(client common) # Runs the Local Discovery Server that other servers register with. -add_executable(ServerLDS src/server_lds.c) -target_link_libraries(ServerLDS common) +add_executable(bobink_opcua_discovery_server src/server_lds.c) +target_link_libraries(bobink_opcua_discovery_server common) # Runs a server that periodically registers itself with the LDS. -add_executable(ServerRegister src/server_register.c) -target_link_libraries(ServerRegister common) +add_executable(bobink_opcua_server src/server_register.c) +target_link_libraries(bobink_opcua_server common) # ====================================== # Documentation diff --git a/readme.md b/readme.md index bc5d4c0..efc42bd 100644 --- a/readme.md +++ b/readme.md @@ -3,9 +3,9 @@ A small C project that demonstrates OPC UA server discovery using the [open62541](https://www.open62541.org/) library. Three programs work together: -- **ServerLDS** — Local Discovery Server that other servers register with -- **ServerRegister** — a server that periodically registers itself with the LDS -- **Client** — queries the LDS for servers, lists endpoints, reads the current time, or downloads a server's certificate +- **bobink_opcua_discovery_server** — Local Discovery Server that other servers register with +- **bobink_opcua_server** — a server that periodically registers itself with the LDS +- **client** — queries the LDS for servers, lists endpoints, reads the current time, or downloads a server's certificate ## Prerequisites @@ -55,23 +55,23 @@ Configuration files live in `tests/` (one directory per test scenario — see ```sh # 1. Local Discovery Server -build/ServerLDS tests/secure_user/server_lds.conf +build/bobink_opcua_discovery_server tests/secure_user/server_lds.conf # 2. Register Server (connects to the LDS on port 14840) -build/ServerRegister tests/secure_user/server_register.conf \ +build/bobink_opcua_server tests/secure_user/server_register.conf \ tests/secure_user/server_register_client.conf opc.tcp://localhost:14840 # 3. Find registered servers via the LDS -build/Client tests/secure_user/client.conf find-servers opc.tcp://localhost:14840 +build/client tests/secure_user/client.conf find-servers opc.tcp://localhost:14840 # 4. List endpoints on the registered server -build/Client tests/secure_user/client.conf get-endpoints opc.tcp://localhost:14841 +build/client tests/secure_user/client.conf get-endpoints opc.tcp://localhost:14841 # 5. Read the current time from the registered server -build/Client tests/secure_user/client.conf read-time opc.tcp://localhost:14841 +build/client tests/secure_user/client.conf read-time opc.tcp://localhost:14841 # 6. Download the server's certificate to a local file -build/Client tests/secure_user/client.conf download-cert opc.tcp://localhost:14841 server.der +build/client tests/secure_user/client.conf download-cert opc.tcp://localhost:14841 server.der ``` All three programs accept an optional log level as the last argument diff --git a/tests/run_cert_bootstrap_test.sh b/tests/run_cert_bootstrap_test.sh index 8d31783..681a4aa 100755 --- a/tests/run_cert_bootstrap_test.sh +++ b/tests/run_cert_bootstrap_test.sh @@ -75,19 +75,19 @@ for port in $LDS_PORT $SR_PORT; do done # ── start LDS ────────────────────────────────────────────────── -build/ServerLDS "$CONFIG_DIR/server_lds.conf" >/dev/null 2>&1 & +build/bobink_opcua_discovery_server "$CONFIG_DIR/server_lds.conf" >/dev/null 2>&1 & LDS_PID=$! -wait_for_port "$LDS_PORT" "$LDS_PID" "ServerLDS" +wait_for_port "$LDS_PORT" "$LDS_PID" "bobink_opcua_discovery_server" # ── start ServerRegister ─────────────────────────────────────── -build/ServerRegister "$CONFIG_DIR/server_register.conf" "$CONFIG_DIR/server_register_client.conf" "opc.tcp://localhost:$LDS_PORT" >/dev/null 2>&1 & +build/bobink_opcua_server "$CONFIG_DIR/server_register.conf" "$CONFIG_DIR/server_register_client.conf" "opc.tcp://localhost:$LDS_PORT" >/dev/null 2>&1 & SR_PID=$! -wait_for_port "$SR_PORT" "$SR_PID" "ServerRegister" +wait_for_port "$SR_PORT" "$SR_PID" "bobink_opcua_server" TMPFILE=$(mktemp) # ── Step 1: FindServers on LDS (client trusts LDS) ──────────── -build/Client "$CONFIG_DIR/client.conf" find-servers "opc.tcp://localhost:$LDS_PORT" >"$TMPFILE" 2>&1 +build/client "$CONFIG_DIR/client.conf" find-servers "opc.tcp://localhost:$LDS_PORT" >"$TMPFILE" 2>&1 FS_RC=$? FS_OUTPUT=$(<"$TMPFILE") @@ -98,7 +98,7 @@ echo "$FS_OUTPUT" | grep -q "urn:localhost:bobink:ServerRegister" check "find-servers contains urn:localhost:bobink:ServerRegister" $? # ── Step 2: GetEndpoints on ServerRegister (should FAIL) ────── -build/Client "$CONFIG_DIR/client.conf" get-endpoints "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 +build/client "$CONFIG_DIR/client.conf" get-endpoints "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 GE_FAIL_RC=$? GE_FAIL_OUTPUT=$(<"$TMPFILE") @@ -108,7 +108,7 @@ check "get-endpoints FAILS without ServerRegister cert (exit code $GE_FAIL_RC)" # ── Step 3: download-cert from ServerRegister (via None) ────── DOWNLOADED_CERT=$(mktemp --suffix=.der) -build/Client "$CONFIG_DIR/client.conf" download-cert "opc.tcp://localhost:$SR_PORT" "$DOWNLOADED_CERT" >"$TMPFILE" 2>&1 +build/client "$CONFIG_DIR/client.conf" download-cert "opc.tcp://localhost:$SR_PORT" "$DOWNLOADED_CERT" >"$TMPFILE" 2>&1 DC_RC=$? DC_OUTPUT=$(<"$TMPFILE") @@ -126,7 +126,7 @@ check "downloaded certificate matches ServerRegister cert.der" $? cp "$DOWNLOADED_CERT" "$CONFIG_DIR/certs/trust_client/ServerRegister_cert.der" # ── Step 6: GetEndpoints on ServerRegister (should succeed) ─── -build/Client "$CONFIG_DIR/client.conf" get-endpoints "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 +build/client "$CONFIG_DIR/client.conf" get-endpoints "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 GE_RC=$? GE_OUTPUT=$(<"$TMPFILE") @@ -137,7 +137,7 @@ echo "$GE_OUTPUT" | grep -q "Aes256_Sha256_RsaPss" check "get-endpoints contains Aes256_Sha256_RsaPss" $? # ── Step 7: ReadTime on ServerRegister (should succeed) ─────── -build/Client "$CONFIG_DIR/client.conf" read-time "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 +build/client "$CONFIG_DIR/client.conf" read-time "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 RT_RC=$? RT_OUTPUT=$(<"$TMPFILE") diff --git a/tests/run_download_cert_test.sh b/tests/run_download_cert_test.sh index f20609c..3631c56 100755 --- a/tests/run_download_cert_test.sh +++ b/tests/run_download_cert_test.sh @@ -63,15 +63,15 @@ if ss -tlnp 2>/dev/null | grep -q ":${LDS_PORT} "; then fi # ── start LDS ────────────────────────────────────────────────── -build/ServerLDS "$CONFIG_DIR/server_lds.conf" >/dev/null 2>&1 & +build/bobink_opcua_discovery_server "$CONFIG_DIR/server_lds.conf" >/dev/null 2>&1 & LDS_PID=$! -wait_for_port "$LDS_PORT" "$LDS_PID" "ServerLDS" +wait_for_port "$LDS_PORT" "$LDS_PID" "bobink_opcua_discovery_server" # ── download certificate ─────────────────────────────────────── TMPFILE=$(mktemp) DOWNLOADED_CERT=$(mktemp --suffix=.der) -build/Client "$CONFIG_DIR/client.conf" download-cert "opc.tcp://localhost:$LDS_PORT" "$DOWNLOADED_CERT" >"$TMPFILE" 2>&1 +build/client "$CONFIG_DIR/client.conf" download-cert "opc.tcp://localhost:$LDS_PORT" "$DOWNLOADED_CERT" >"$TMPFILE" 2>&1 DC_RC=$? DC_OUTPUT=$(<"$TMPFILE") diff --git a/tests/run_test.sh b/tests/run_test.sh index fc44ad6..6d17958 100755 --- a/tests/run_test.sh +++ b/tests/run_test.sh @@ -63,14 +63,14 @@ for port in $LDS_PORT $SR_PORT; do done # ── start LDS ────────────────────────────────────────────────── -build/ServerLDS "$CONFIG_DIR/server_lds.conf" >/dev/null 2>&1 & +build/bobink_opcua_discovery_server "$CONFIG_DIR/server_lds.conf" >/dev/null 2>&1 & LDS_PID=$! -wait_for_port "$LDS_PORT" "$LDS_PID" "ServerLDS" +wait_for_port "$LDS_PORT" "$LDS_PID" "bobink_opcua_discovery_server" # ── start ServerRegister ─────────────────────────────────────── -build/ServerRegister "$CONFIG_DIR/server_register.conf" "$CONFIG_DIR/server_register_client.conf" "opc.tcp://localhost:$LDS_PORT" >/dev/null 2>&1 & +build/bobink_opcua_server "$CONFIG_DIR/server_register.conf" "$CONFIG_DIR/server_register_client.conf" "opc.tcp://localhost:$LDS_PORT" >/dev/null 2>&1 & SR_PID=$! -wait_for_port "$SR_PORT" "$SR_PID" "ServerRegister" +wait_for_port "$SR_PORT" "$SR_PID" "bobink_opcua_server" # ── validation helper ───────────────────────────────────────── check() { @@ -85,7 +85,7 @@ check() { # ── FindServers ─────────────────────────────────────────────── TMPFILE=$(mktemp) -build/Client "$CONFIG_DIR/client.conf" find-servers "opc.tcp://localhost:$LDS_PORT" >"$TMPFILE" 2>&1 +build/client "$CONFIG_DIR/client.conf" find-servers "opc.tcp://localhost:$LDS_PORT" >"$TMPFILE" 2>&1 FS_RC=$? FS_OUTPUT=$(<"$TMPFILE") @@ -96,7 +96,7 @@ echo "$FS_OUTPUT" | grep -q "urn:localhost:bobink:ServerRegister" check "find-servers contains urn:localhost:bobink:ServerRegister" $? # ── GetEndpoints ────────────────────────────────────────────── -build/Client "$CONFIG_DIR/client.conf" get-endpoints "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 +build/client "$CONFIG_DIR/client.conf" get-endpoints "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 GE_RC=$? GE_OUTPUT=$(<"$TMPFILE") @@ -107,7 +107,7 @@ echo "$GE_OUTPUT" | grep -q "$EXPECTED_POLICY" check "get-endpoints contains $EXPECTED_POLICY" $? # ── ReadTime ────────────────────────────────────────────────── -build/Client "$CONFIG_DIR/client.conf" read-time "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 +build/client "$CONFIG_DIR/client.conf" read-time "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 RT_RC=$? RT_OUTPUT=$(<"$TMPFILE") -- cgit v1.2.3