diff --git a/port/posix/posix_transport_mem.h b/port/posix/posix_transport_mem.h
deleted file mode 100644
index 406607eb..00000000
--- a/port/posix/posix_transport_mem.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2024 wolfSSL Inc.
- *
- * This file is part of wolfHSM.
- *
- * wolfHSM is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * wolfHSM is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with wolfHSM. If not, see .
- */
-/*
- * port/posix_transport_mem.h
- *
- * wolfHSM Transport Mem binding using POSIX shared memory
- */
-
-/* Memory block comms
- * Example usage:
- *
- *
- * whTransportMemConfig tmcfg[1] = {{
- * .req = req_buffer,
- * .req_size = sizeof(req_buffer),
- * .resp = resp_buffer
- * .resp_size = sizeof(resp_buffer),
- * }};
- *
- * whTransportClientCb tmccb[1] = {WH_TRANSPORT_MEM_CLIENT_CB};
- * whTransportMemClientContext tmcc[1] = {0};
- * whCommClientConfig ccc[1] = {{
- * .transport_cb = tmccb,
- * .transport_context = tmcc,
- * .transport_config = tmcfg,
- * .client_id = 1234,
- * }};
- * whCommClient cc[1] = {0};
- * wh_CommClient_Init(cc, ccc);
- *
- * whTransportServerCb tmscb[1] = {WH_TRANSPORT_MEM_SERVER_CB};
- * whTransportMemServerContext tmsc[1] = {0};
- * whCommServerConfig csc[1] = {{
- * .transport_cb = tmscb,
- * .transport_context = tmsc,
- * .transport_config = tmcfg,
- * .server_id = 5678,
- * }};
- * whCommServer cs[1] = {0};
- * wh_CommServer_Init(cs, csc);
- *
- */
-
-#ifndef PORT_POSIX_POSIX_TRANSPORT_MEM_H_
-#define PORT_POSIX_POSIX_TRANSPORT_MEM_H_
-
-/* Pick up compile-time configuration */
-#include "wolfhsm/wh_settings.h"
-
-#include
-
-#include "wolfhsm/wh_transport_mem.h"
-#include "wolfhsm/wh_comm.h"
-
-/** Common configuration structure */
-typedef struct {
- char* shmFileName; /* Null terminated, up to NAME_MAX */
- uint16_t req_size;
- uint16_t resp_size;
- uint8_t WH_PAD[4];
-} posixTransportMemConfig;
-
-
-/** Common context */
-
-typedef struct {
- char* shmFileName;
- void* shmBuf;
- whTransportMemContext* transport_ctx;
-} posixTransportMemContext;
-
-/* Naming conveniences. Reuses the same types. */
-typedef posixTransportMemContext posixTransportMemClientContext;
-typedef posixTransportMemContext posixTransportMemServerContext;
-
-/** Callback function declarations */
-int posixTransportMem_ClientInit(void* c, const void* cf,
- whCommSetConnectedCb connectcb,
- void* connectcb_arg);
-int posixTransportMem_ServerInit(void* c, const void* cf,
- whCommSetConnectedCb connectcb,
- void* connectcb_arg);
-
-int posixTransportMem_Cleanup(void* c);
-int posixTransportMem_SendRequest(void* c, uint16_t len, const void* data);
-int posixTransportMem_RecvRequest(void* c, uint16_t* out_len, void* data);
-int posixTransportMem_SendResponse(void* c, uint16_t len, const void* data);
-int posixTransportMem_RecvResponse(void* c, uint16_t* out_len, void* data);
-
-#define POSIX_TRANSPORT_MEM_CLIENT_CB \
- { \
- .Init = posixTransportMem_ClientInit, \
- .Send = posixTransportMem_SendRequest, \
- .Recv = posixTransportMem_RecvResponse, \
- .Cleanup = posixTransportMem_Cleanup, \
- }
-
-#define POSIX_TRANSPORT_MEM_SERVER_CB \
- { \
- .Init = posixTransportMem_ServerInit, \
- .Recv = posixTransportMem_RecvRequest, \
- .Send = posixTransportMem_SendResponse, \
- .Cleanup = posixTransportMem_Cleanup, \
- }
-
-
-#endif /* !PORT_POSIX_POSIX_TRANSPORT_MEM_H_ */
diff --git a/port/posix/posix_transport_mem.c b/port/posix/posix_transport_shm.c
similarity index 69%
rename from port/posix/posix_transport_mem.c
rename to port/posix/posix_transport_shm.c
index 6c4e4335..e3c92b76 100644
--- a/port/posix/posix_transport_mem.c
+++ b/port/posix/posix_transport_shm.c
@@ -1,4 +1,4 @@
-#include "port/posix/posix_transport_mem.h"
+#include "port/posix/posix_transport_shm.h"
#include /* For O_* constants */
#include /* For shm_open, mmap */
@@ -19,50 +19,49 @@ typedef struct {
} ShmHeader;
/** Callback function declarations */
-int posixTransportMem_ServerInit(void* c, const void* cf,
+int posixTransportShm_ServerInit(void* c, const void* cf,
whCommSetConnectedCb connectcb,
void* connectcb_arg)
{
int rc;
int shmFd;
- struct stat shmStat;
size_t shmSize;
size_t shmNameLen;
ShmHeader* header;
whTransportMemConfig tMemCfg;
- posixTransportMemContext* ctx = (posixTransportMemContext*)c;
- posixTransportMemConfig* config = (posixTransportMemConfig*)cf;
+ posixTransportShmContext* ctx = (posixTransportShmContext*)c;
+ posixTransportShmConfig* config = (posixTransportShmConfig*)cf;
- if (ctx == NULL || config == NULL || config->shmFileName == NULL) {
+ if (ctx == NULL || config == NULL || config->shmObjName == NULL) {
return WH_ERROR_BADARGS;
}
- /* check shmFileName for max length */
- shmNameLen = strnlen(config->shmFileName, NAME_MAX + 1);
+ /* check shmObjName for max length */
+ shmNameLen = strnlen(config->shmObjName, NAME_MAX + 1);
if (shmNameLen > NAME_MAX) {
return WH_ERROR_BADARGS;
}
- ctx->shmFileName = calloc(shmNameLen + 1, sizeof(char));
- strncpy(ctx->shmFileName, config->shmFileName, shmNameLen);
+ ctx->shmObjName = calloc(shmNameLen + 1, sizeof(char));
+ strncpy(ctx->shmObjName, config->shmObjName, shmNameLen);
shmSize = sizeof(ShmHeader) + config->req_size + config->resp_size;
/* Attempt to open the shared memory object serving as the backing store
* without attempting to create it. If it already exists, attempt to delete
* it, and verify that it is gone. */
- shmFd = shm_open(ctx->shmFileName, O_RDWR, 0666);
+ shmFd = shm_open(ctx->shmObjName, O_RDWR, 0666);
if (shmFd > 0) {
close(shmFd);
- shm_unlink(ctx->shmFileName);
- shmFd = shm_open(ctx->shmFileName, O_RDWR, 0666);
+ shm_unlink(ctx->shmObjName);
+ shmFd = shm_open(ctx->shmObjName, O_RDWR, 0666);
}
/* If shared memory object doesn't exist, create it and set the size */
if (shmFd == -1) {
if (errno == ENOENT) {
/* Shared memory object doesn't exist, create it */
- shmFd = shm_open(ctx->shmFileName, O_CREAT | O_RDWR, 0666);
+ shmFd = shm_open(ctx->shmObjName, O_CREAT | O_RDWR, 0666);
if (shmFd == -1) {
perror("server shm_open");
exit(EXIT_FAILURE);
@@ -103,8 +102,8 @@ int posixTransportMem_ServerInit(void* c, const void* cf,
atomic_fetch_add(&header->refCount, 1);
/* allocate a shared memory transport context */
- ctx->transport_ctx = malloc(sizeof(whTransportMemContext));
- if (ctx->transport_ctx == NULL) {
+ ctx->transportMemCtx = malloc(sizeof(whTransportMemContext));
+ if (ctx->transportMemCtx == NULL) {
return WH_ERROR_ABORTED;
}
@@ -115,7 +114,7 @@ int posixTransportMem_ServerInit(void* c, const void* cf,
tMemCfg.resp = ctx->shmBuf + sizeof(ShmHeader) + config->req_size;
/* Initialize the shared memory transport using our newly mmapped buffer */
- rc = wh_TransportMem_Init(ctx->transport_ctx, &tMemCfg, connectcb,
+ rc = wh_TransportMem_Init(ctx->transportMemCtx, &tMemCfg, connectcb,
connectcb_arg);
if (rc != WH_ERROR_OK) {
return rc;
@@ -128,7 +127,7 @@ int posixTransportMem_ServerInit(void* c, const void* cf,
/** Callback function declarations */
-int posixTransportMem_ClientInit(void* c, const void* cf,
+int posixTransportShm_ClientInit(void* c, const void* cf,
whCommSetConnectedCb connectcb,
void* connectcb_arg)
{
@@ -139,28 +138,28 @@ int posixTransportMem_ClientInit(void* c, const void* cf,
size_t shmNameLen;
ShmHeader* header;
whTransportMemConfig tMemCfg;
- posixTransportMemContext* ctx = (posixTransportMemContext*)c;
- posixTransportMemConfig* config = (posixTransportMemConfig*)cf;
+ posixTransportShmContext* ctx = (posixTransportShmContext*)c;
+ posixTransportShmConfig* config = (posixTransportShmConfig*)cf;
- if (ctx == NULL || config == NULL || config->shmFileName == NULL) {
+ if (ctx == NULL || config == NULL || config->shmObjName == NULL) {
return WH_ERROR_BADARGS;
}
- /* check shmFileName for max length */
- shmNameLen = strnlen(config->shmFileName, NAME_MAX + 1);
+ /* check shmObjName for max length */
+ shmNameLen = strnlen(config->shmObjName, NAME_MAX + 1);
if (shmNameLen > NAME_MAX) {
return WH_ERROR_BADARGS;
}
- ctx->shmFileName = calloc(shmNameLen + 1, sizeof(char));
- strncpy(ctx->shmFileName, config->shmFileName, shmNameLen);
+ ctx->shmObjName = calloc(shmNameLen + 1, sizeof(char));
+ strncpy(ctx->shmObjName, config->shmObjName, shmNameLen);
shmSize = sizeof(ShmHeader) + config->req_size + config->resp_size;
/* Attempt to open the shared memory backing store. If it doesn't exist yet,
* sleep */
while (1) {
- shmFd = shm_open(ctx->shmFileName, O_RDWR, 0666);
+ shmFd = shm_open(ctx->shmObjName, O_RDWR, 0666);
if (shmFd == -1) {
if (errno != ENOENT) {
perror("client shm_open");
@@ -209,8 +208,8 @@ int posixTransportMem_ClientInit(void* c, const void* cf,
}
/* allocate a shared memory transport context */
- ctx->transport_ctx = malloc(sizeof(whTransportMemContext));
- if (ctx->transport_ctx == NULL) {
+ ctx->transportMemCtx = malloc(sizeof(whTransportMemContext));
+ if (ctx->transportMemCtx == NULL) {
return WH_ERROR_ABORTED;
}
@@ -221,17 +220,17 @@ int posixTransportMem_ClientInit(void* c, const void* cf,
tMemCfg.resp = ctx->shmBuf + sizeof(ShmHeader) + config->req_size;
/* Initialize the shared memory transport using our newly mmapped buffer */
- rc = wh_TransportMem_Init(ctx->transport_ctx, &tMemCfg, connectcb,
+ rc = wh_TransportMem_Init(ctx->transportMemCtx, &tMemCfg, connectcb,
connectcb_arg);
if (rc != WH_ERROR_OK) {
return rc;
}
/* Clear the comms buffers */
- wh_Utils_memset_flush((void*)ctx->transport_ctx->req, 0,
- ctx->transport_ctx->req_size);
- wh_Utils_memset_flush((void*)ctx->transport_ctx->resp, 0,
- ctx->transport_ctx->resp_size);
+ wh_Utils_memset_flush((void*)ctx->transportMemCtx->req, 0,
+ ctx->transportMemCtx->req_size);
+ wh_Utils_memset_flush((void*)ctx->transportMemCtx->resp, 0,
+ ctx->transportMemCtx->resp_size);
/* Close the file descriptor after mmap */
close(shmFd);
@@ -239,12 +238,12 @@ int posixTransportMem_ClientInit(void* c, const void* cf,
}
-int posixTransportMem_Cleanup(void* c)
+int posixTransportShm_Cleanup(void* c)
{
- posixTransportMemContext* ctx = (posixTransportMemContext*)c;
+ posixTransportShmContext* ctx = (posixTransportShmContext*)c;
ShmHeader* header;
- if (ctx == NULL || ctx->transport_ctx == NULL || ctx->shmBuf == NULL) {
+ if (ctx == NULL || ctx->transportMemCtx == NULL || ctx->shmBuf == NULL) {
return WH_ERROR_BADARGS;
}
@@ -253,74 +252,74 @@ int posixTransportMem_Cleanup(void* c)
/* Decrement the reference count */
if (atomic_fetch_sub(&header->refCount, 1) == 1) {
/* If the reference count is now zero, unlink the shared memory */
- if (shm_unlink(ctx->shmFileName) == -1) {
+ if (shm_unlink(ctx->shmObjName) == -1) {
perror("shm_unlink");
exit(EXIT_FAILURE);
}
}
/* Unmap the shared memory */
- if (munmap(ctx->shmBuf, sizeof(header) + ctx->transport_ctx->req_size +
- ctx->transport_ctx->resp_size) == -1) {
+ if (munmap(ctx->shmBuf, sizeof(header) + ctx->transportMemCtx->req_size +
+ ctx->transportMemCtx->resp_size) == -1) {
perror("munmap");
exit(EXIT_FAILURE);
}
/* Free the allocated memory */
- free(ctx->shmFileName);
- free(ctx->transport_ctx);
+ free(ctx->shmObjName);
+ free(ctx->transportMemCtx);
return 0;
}
-int posixTransportMem_SendRequest(void* c, uint16_t len, const void* data)
+int posixTransportShm_SendRequest(void* c, uint16_t len, const void* data)
{
- posixTransportMemContext* ctx = (posixTransportMemContext*)c;
+ posixTransportShmContext* ctx = (posixTransportShmContext*)c;
/* Only need to check NULL, mem transport checks other state info */
if (ctx == NULL) {
return WH_ERROR_BADARGS;
}
- return wh_TransportMem_SendRequest(ctx->transport_ctx, len, data);
+ return wh_TransportMem_SendRequest(ctx->transportMemCtx, len, data);
}
-int posixTransportMem_RecvRequest(void* c, uint16_t* out_len, void* data)
+int posixTransportShm_RecvRequest(void* c, uint16_t* out_len, void* data)
{
- posixTransportMemContext* ctx = (posixTransportMemContext*)c;
+ posixTransportShmContext* ctx = (posixTransportShmContext*)c;
/* Only need to check NULL, mem transport checks other state info */
if (ctx == NULL) {
return WH_ERROR_BADARGS;
}
- return wh_TransportMem_RecvRequest(ctx->transport_ctx, out_len, data);
+ return wh_TransportMem_RecvRequest(ctx->transportMemCtx, out_len, data);
}
-int posixTransportMem_SendResponse(void* c, uint16_t len, const void* data)
+int posixTransportShm_SendResponse(void* c, uint16_t len, const void* data)
{
- posixTransportMemContext* ctx = (posixTransportMemContext*)c;
+ posixTransportShmContext* ctx = (posixTransportShmContext*)c;
/* Only need to check NULL, mem transport checks other state info */
if (ctx == NULL) {
return WH_ERROR_BADARGS;
}
- return wh_TransportMem_SendResponse(ctx->transport_ctx, len, data);
+ return wh_TransportMem_SendResponse(ctx->transportMemCtx, len, data);
}
-int posixTransportMem_RecvResponse(void* c, uint16_t* out_len, void* data)
+int posixTransportShm_RecvResponse(void* c, uint16_t* out_len, void* data)
{
- posixTransportMemContext* ctx = (posixTransportMemContext*)c;
+ posixTransportShmContext* ctx = (posixTransportShmContext*)c;
/* Only need to check NULL, mem transport checks other state info */
if (ctx == NULL) {
return WH_ERROR_BADARGS;
}
- return wh_TransportMem_RecvResponse(ctx->transport_ctx, out_len, data);
-}
\ No newline at end of file
+ return wh_TransportMem_RecvResponse(ctx->transportMemCtx, out_len, data);
+}
diff --git a/port/posix/posix_transport_shm.h b/port/posix/posix_transport_shm.h
new file mode 100644
index 00000000..d3686630
--- /dev/null
+++ b/port/posix/posix_transport_shm.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2024 wolfSSL Inc.
+ *
+ * This file is part of wolfHSM.
+ *
+ * wolfHSM is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfHSM is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with wolfHSM. If not, see .
+ */
+/*
+ * port/posix_transport_shm.h
+ *
+ * wolfHSM Transport Mem binding using POSIX shared memory functionality
+ */
+
+#ifndef PORT_POSIX_POSIX_TRANSPORT_SHM_H_
+#define PORT_POSIX_POSIX_TRANSPORT_SHM_H_
+
+/* Pick up compile-time configuration */
+#include "wolfhsm/wh_settings.h"
+
+#include
+
+#include "wolfhsm/wh_transport_mem.h"
+#include "wolfhsm/wh_comm.h"
+
+/** Common configuration structure */
+typedef struct {
+ char* shmObjName; /* Null terminated, up to NAME_MAX */
+ uint16_t req_size;
+ uint16_t resp_size;
+ uint8_t WH_PAD[4];
+} posixTransportShmConfig;
+
+
+/** Common context */
+
+typedef struct {
+ char* shmObjName;
+ void* shmBuf;
+ whTransportMemContext* transportMemCtx;
+} posixTransportShmContext;
+
+/* Naming conveniences. Reuses the same types. */
+typedef posixTransportShmContext posixTransportShmClientContext;
+typedef posixTransportShmContext posixTransportShmServerContext;
+
+/** Callback function declarations */
+int posixTransportShm_ClientInit(void* c, const void* cf,
+ whCommSetConnectedCb connectcb,
+ void* connectcb_arg);
+int posixTransportShm_ServerInit(void* c, const void* cf,
+ whCommSetConnectedCb connectcb,
+ void* connectcb_arg);
+
+int posixTransportShm_Cleanup(void* c);
+int posixTransportShm_SendRequest(void* c, uint16_t len, const void* data);
+int posixTransportShm_RecvRequest(void* c, uint16_t* out_len, void* data);
+int posixTransportShm_SendResponse(void* c, uint16_t len, const void* data);
+int posixTransportShm_RecvResponse(void* c, uint16_t* out_len, void* data);
+
+#define POSIX_TRANSPORT_SHM_CLIENT_CB \
+ { \
+ .Init = posixTransportShm_ClientInit, \
+ .Send = posixTransportShm_SendRequest, \
+ .Recv = posixTransportShm_RecvResponse, \
+ .Cleanup = posixTransportShm_Cleanup, \
+ }
+
+#define POSIX_TRANSPORT_SHM_SERVER_CB \
+ { \
+ .Init = posixTransportShm_ServerInit, \
+ .Recv = posixTransportShm_RecvRequest, \
+ .Send = posixTransportShm_SendResponse, \
+ .Cleanup = posixTransportShm_Cleanup, \
+ }
+
+
+#endif /* !PORT_POSIX_POSIX_TRANSPORT_SHM_H_ */
diff --git a/test/Makefile b/test/Makefile
index eb753e01..b9ebb2c5 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -134,7 +134,7 @@ SRC_C += \
$(WOLFHSM_DIR)/src/wh_transport_mem.c \
$(WOLFHSM_DIR)/port/posix/posix_flash_file.c \
$(WOLFHSM_DIR)/port/posix/posix_transport_tcp.c \
- $(WOLFHSM_DIR)/port/posix/posix_transport_mem.c
+ $(WOLFHSM_DIR)/port/posix/posix_transport_shm.c
# APP
SRC_C += \
@@ -144,8 +144,8 @@ SRC_C += \
./src/wh_test_she.c \
./src/wh_test_nvm_flash.c \
./src/wh_test_clientserver.c \
- ./src/wh_test_flash_ramsim.c \
-
+ ./src/wh_test_flash_ramsim.c
+
ifeq ($(TESTWOLFCRYPT),1)
SRC_C += ./src/wh_test_wolfcrypt_test.c
endif
diff --git a/test/wh_test.c b/test/wh_test.c
index 3eae52ab..d69d5228 100644
--- a/test/wh_test.c
+++ b/test/wh_test.c
@@ -45,6 +45,7 @@
int whTest_Unit(void)
{
printf("Enter unit tests\n");
+
/* Component Tests */
WH_TEST_ASSERT(0 == whTest_Flash_RamSim());
WH_TEST_ASSERT(0 == whTest_NvmFlash());
diff --git a/test/wh_test_clientserver.c b/test/wh_test_clientserver.c
index ee68dcdf..8be71cd3 100644
--- a/test/wh_test_clientserver.c
+++ b/test/wh_test_clientserver.c
@@ -39,7 +39,7 @@
#include /* For pthread_create/cancel/join/_t */
#include /* For sleep */
-#include "port/posix/posix_transport_mem.h"
+#include "port/posix/posix_transport_shm.h"
#endif
@@ -1630,15 +1630,15 @@ static int wh_ClientServer_MemThreadTest(void)
static int wh_ClientServer_PosixMemMapThreadTest(void)
{
- posixTransportMemConfig tmcf[1] = {{
- .shmFileName = "/wh_test_clientserver_shm",
- .req_size = BUFFER_SIZE,
- .resp_size = BUFFER_SIZE,
+ posixTransportShmConfig tmcf[1] = {{
+ .shmObjName = "/wh_test_clientserver_shm",
+ .req_size = BUFFER_SIZE,
+ .resp_size = BUFFER_SIZE,
}};
/* Client configuration/contexts */
- whTransportClientCb tccb[1] = {POSIX_TRANSPORT_MEM_CLIENT_CB};
- posixTransportMemClientContext tmcc[1] = {0};
+ whTransportClientCb tccb[1] = {POSIX_TRANSPORT_SHM_CLIENT_CB};
+ posixTransportShmClientContext tmcc[1] = {0};
whCommClientConfig cc_conf[1] = {{
.transport_cb = tccb,
.transport_context = (void*)tmcc,
@@ -1649,8 +1649,8 @@ static int wh_ClientServer_PosixMemMapThreadTest(void)
.comm = cc_conf,
}};
/* Server configuration/contexts */
- whTransportServerCb tscb[1] = {POSIX_TRANSPORT_MEM_SERVER_CB};
- posixTransportMemServerContext tmsc[1] = {0};
+ whTransportServerCb tscb[1] = {POSIX_TRANSPORT_SHM_SERVER_CB};
+ posixTransportShmServerContext tmsc[1] = {0};
whCommServerConfig cs_conf[1] = {{
.transport_cb = tscb,
.transport_context = (void*)tmsc,
@@ -1729,7 +1729,7 @@ int whTest_ClientServer(void)
printf("Testing client/server: (pthread) mem...\n");
WH_TEST_ASSERT(0 == wh_ClientServer_MemThreadTest());
- printf("Testing client/server: (pthread) posix mem...\n");
+ printf("Testing client/server: (pthread) POSIX shared memory ...\n");
WH_TEST_ASSERT(0 == wh_ClientServer_PosixMemMapThreadTest());
#endif /* defined(WOLFHSM_CFG_TEST_POSIX) */
diff --git a/test/wh_test_comm.c b/test/wh_test_comm.c
index cdb36481..fdb81211 100644
--- a/test/wh_test_comm.c
+++ b/test/wh_test_comm.c
@@ -37,7 +37,7 @@
#include /* For pthread_create/cancel/join/_t */
#include /* For sleep */
#include "port/posix/posix_transport_tcp.h"
-#include "port/posix/posix_transport_mem.h"
+#include "port/posix/posix_transport_shm.h"
#endif
@@ -409,30 +409,30 @@ void wh_CommClientServer_MemThreadTest(void)
void wh_CommClientServer_ShMemThreadTest(void)
{
/* Transport memory configuration */
- posixTransportMemConfig tmcf[1] = {{
- .shmFileName = "/wh_test_comm_shm",
- .req_size = BUFFER_SIZE,
- .resp_size = BUFFER_SIZE,
+ posixTransportShmConfig tmcf[1] = {{
+ .shmObjName = "/wh_test_comm_shm",
+ .req_size = BUFFER_SIZE,
+ .resp_size = BUFFER_SIZE,
}};
/* Client configuration/contexts */
- whTransportClientCb tmccb[1] = {POSIX_TRANSPORT_MEM_CLIENT_CB};
- whTransportMemClientContext csc[1] = {};
- whCommClientConfig c_conf[1] = {{
- .transport_cb = tmccb,
- .transport_context = (void*)csc,
- .transport_config = (void*)tmcf,
- .client_id = 123,
+ whTransportClientCb tmccb[1] = {POSIX_TRANSPORT_SHM_CLIENT_CB};
+ posixTransportShmClientContext csc[1] = {};
+ whCommClientConfig c_conf[1] = {{
+ .transport_cb = tmccb,
+ .transport_context = (void*)csc,
+ .transport_config = (void*)tmcf,
+ .client_id = 123,
}};
/* Server configuration/contexts */
- whTransportServerCb tmscb[1] = {POSIX_TRANSPORT_MEM_SERVER_CB};
- whTransportMemServerContext css[1] = {};
- whCommServerConfig s_conf[1] = {{
- .transport_cb = tmscb,
- .transport_context = (void*)css,
- .transport_config = (void*)tmcf,
- .server_id = 124,
+ whTransportServerCb tmscb[1] = {POSIX_TRANSPORT_SHM_SERVER_CB};
+ posixTransportShmServerContext css[1] = {};
+ whCommServerConfig s_conf[1] = {{
+ .transport_cb = tmscb,
+ .transport_context = (void*)css,
+ .transport_config = (void*)tmcf,
+ .server_id = 124,
}};
_whCommClientServerThreadTest(c_conf, s_conf);