From 827e90e0daabe32e058e08dd2a253425898a7e7a Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Tue, 17 Feb 2026 19:06:22 +0100 Subject: Replace ClientFindServers with unified Client, use trust store directories Replace the single-purpose ClientFindServers program with a unified Client that supports three operations via CLI: find-servers, get-endpoints, and read-time. This simplifies the architecture by using one client binary with a single config file instead of a monolithic program that did everything in one run. Split the ServerRegister config into separate server and client config files so the LDS-registration credentials are isolated from the server's own settings. The discovery URL moves from config to a CLI argument. Replace repeated trustList config entries with a single trustStore directory path. Each program now points to a directory under certs/trust/ containing .der files, so adding or removing trust is a file-copy operation rather than editing every config file. Add loadTrustStore()/freeTrustStore() to common.c and remove the now-unused configGetAll() from the config parser. Simplify the test matrix from 6 to 4 cases (security and auth are orthogonal, so the full 3x2 matrix is unnecessary). Update run_test.sh to invoke the new Client three times and use port-polling instead of sleep. --- src/common.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/common.h') diff --git a/src/common.h b/src/common.h index e8c0c78..7290181 100644 --- a/src/common.h +++ b/src/common.h @@ -13,6 +13,8 @@ #include #include +#include + /** * @brief Loads a DER-encoded certificate or key file into a UA_ByteString. * @@ -21,6 +23,29 @@ */ UA_ByteString loadFile (const char *const path); +/** + * @brief Collects all *.der file paths from a trust store directory. + * + * Opens the directory, finds every file ending in ".der", and builds + * heap-allocated full paths (dirPath/filename). The caller must free + * the result with freeTrustStore(). + * + * @param dirPath Path to the trust store directory. + * @param outPaths Output: heap-allocated array of heap-allocated strings. + * Set to NULL when the directory is empty. + * @param outSize Output: number of entries in outPaths. + * @return 0 on success, -1 on error (logged via UA_LOG_ERROR). + */ +int loadTrustStore (const char *dirPath, char ***outPaths, size_t *outSize); + +/** + * @brief Frees the array returned by loadTrustStore(). + * + * @param paths The array of strings (may be NULL). + * @param size Number of entries. + */ +void freeTrustStore (char **paths, size_t size); + /** * @brief Creates a UA_Server configured with security policies and encryption. * -- cgit v1.2.3