diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-19 00:14:25 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-02-19 00:14:25 +0100 |
| commit | a9ebc3b434b7979163fdf83984b32f1e513dacb8 (patch) | |
| tree | c801a98f44689669c905e833371fa539f4934a1f | |
| parent | bdc2305c2376c8b6697b6ecfecce104c956bdfcf (diff) | |
| download | BobinkCOpcUa-a9ebc3b434b7979163fdf83984b32f1e513dacb8.tar.gz BobinkCOpcUa-a9ebc3b434b7979163fdf83984b32f1e513dacb8.zip | |
Rename client executable to bobink_opcua_client
| -rw-r--r-- | CMakeLists.txt | 9 | ||||
| -rw-r--r-- | readme.md | 10 | ||||
| -rw-r--r-- | src/bobink_opcua_client.c (renamed from src/client.c) | 0 | ||||
| -rwxr-xr-x | tests/run_cert_bootstrap_test.sh | 10 | ||||
| -rwxr-xr-x | tests/run_download_cert_test.sh | 2 | ||||
| -rwxr-xr-x | tests/run_test.sh | 6 |
6 files changed, 19 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a0870c..1d9f7a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,9 @@ # # 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. +# bobink_opcua_server periodically registers itself with the LDS. +# bobink_opcua_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. @@ -28,8 +29,8 @@ 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(bobink_opcua_client src/bobink_opcua_client.c) +target_link_libraries(bobink_opcua_client common) # Runs the Local Discovery Server that other servers register with. add_executable(bobink_opcua_discovery_server src/server_lds.c) @@ -5,7 +5,7 @@ A small C project that demonstrates OPC UA server discovery using the - **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 +- **bobink_opcua_client** — queries the LDS for servers, lists endpoints, reads the current time, or downloads a server's certificate ## Prerequisites @@ -62,16 +62,16 @@ 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/bobink_opcua_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/bobink_opcua_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/bobink_opcua_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/bobink_opcua_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/src/client.c b/src/bobink_opcua_client.c index 35a3e6f..35a3e6f 100644 --- a/src/client.c +++ b/src/bobink_opcua_client.c diff --git a/tests/run_cert_bootstrap_test.sh b/tests/run_cert_bootstrap_test.sh index d0f4a3e..5db2b7b 100755 --- a/tests/run_cert_bootstrap_test.sh +++ b/tests/run_cert_bootstrap_test.sh @@ -54,7 +54,7 @@ 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/bobink_opcua_client "$CONFIG_DIR/client.conf" find-servers "opc.tcp://localhost:$LDS_PORT" >"$TMPFILE" 2>&1 FS_RC=$? FS_OUTPUT=$(<"$TMPFILE") @@ -65,7 +65,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/bobink_opcua_client "$CONFIG_DIR/client.conf" get-endpoints "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 GE_FAIL_RC=$? GE_FAIL_OUTPUT=$(<"$TMPFILE") @@ -75,7 +75,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/bobink_opcua_client "$CONFIG_DIR/client.conf" download-cert "opc.tcp://localhost:$SR_PORT" "$DOWNLOADED_CERT" >"$TMPFILE" 2>&1 DC_RC=$? DC_OUTPUT=$(<"$TMPFILE") @@ -93,7 +93,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/bobink_opcua_client "$CONFIG_DIR/client.conf" get-endpoints "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 GE_RC=$? GE_OUTPUT=$(<"$TMPFILE") @@ -104,7 +104,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/bobink_opcua_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 7dd7dfd..f60cd20 100755 --- a/tests/run_download_cert_test.sh +++ b/tests/run_download_cert_test.sh @@ -40,7 +40,7 @@ wait_for_port "$LDS_PORT" "$LDS_PID" "bobink_opcua_discovery_server" 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/bobink_opcua_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 8f6c21b..85eb291 100755 --- a/tests/run_test.sh +++ b/tests/run_test.sh @@ -51,7 +51,7 @@ wait_for_port "$SR_PORT" "$SR_PID" "bobink_opcua_server" # ── FindServers ─────────────────────────────────────────────── TMPFILE=$(mktemp) -build/client "$CONFIG_DIR/client.conf" find-servers "opc.tcp://localhost:$LDS_PORT" >"$TMPFILE" 2>&1 +build/bobink_opcua_client "$CONFIG_DIR/client.conf" find-servers "opc.tcp://localhost:$LDS_PORT" >"$TMPFILE" 2>&1 FS_RC=$? FS_OUTPUT=$(<"$TMPFILE") @@ -62,7 +62,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/bobink_opcua_client "$CONFIG_DIR/client.conf" get-endpoints "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 GE_RC=$? GE_OUTPUT=$(<"$TMPFILE") @@ -73,7 +73,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/bobink_opcua_client "$CONFIG_DIR/client.conf" read-time "opc.tcp://localhost:$SR_PORT" >"$TMPFILE" 2>&1 RT_RC=$? RT_OUTPUT=$(<"$TMPFILE") |
