aboutsummaryrefslogtreecommitdiffstats
path: root/src/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h25
1 files changed, 25 insertions, 0 deletions
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 <open62541/server.h>
#include <open62541/types.h>
+#include <stddef.h>
+
/**
* @brief Loads a DER-encoded certificate or key file into a UA_ByteString.
*
@@ -22,6 +24,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.
*
* The server is initialized with the specified port, certificate, private key,