Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"dockerComposeFile": "docker-compose.yml",
// Pick one service — comment the active line, uncomment the desired one,
// then "Dev Containers: Rebuild Container". See docs/containers.md.
"service": "gcc", // host development — BUILD_PRESET=debug
// "service": "gcc", // host development — BUILD_PRESET=debug
// "service": "clang", // clang variant — BUILD_PRESET=clang-debug
// "service": "freertos-host", // FreeRTOS adapter TDD vs fakes — BUILD_PRESET=debug
// "service": "freertos-target", // ARM cross + QEMU + GDB — BUILD_PRESET=freertos-cross
"service": "freertos-target", // ARM cross + QEMU + GDB — BUILD_PRESET=freertos-cross
// "service": "behave", // BDD scenarios — no cmake (BUILD_PRESET unset)
"workspaceFolder": "/workspaces/SolidSyslog",
"features": {
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ services:
command: sleep infinity

freertos-host:
image: ghcr.io/davidcozens/cpputest-freertos:sha-bbc958b
image: ghcr.io/davidcozens/cpputest-freertos:sha-1cb0f34
volumes:
- ..:/workspaces/SolidSyslog:cached
- ${SSH_AUTH_SOCK:-/dev/null}:/ssh-agent
Expand Down Expand Up @@ -153,7 +153,7 @@ services:
- syslog-ng

freertos-target:
image: ghcr.io/davidcozens/cpputest-freertos-cross:sha-bbc958b
image: ghcr.io/davidcozens/cpputest-freertos-cross:sha-1cb0f34
volumes:
- ..:/workspaces/SolidSyslog:cached
- syslog-ng-ctl-freertos:/var/lib/syslog-ng
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
# cpputest-freertos image carries /opt/mbedtls (and exports MBEDTLS_DIR);
# Tests/MbedTlsIntegration/CMakeLists.txt requires that env var.
container:
image: ghcr.io/davidcozens/cpputest-freertos:sha-bbc958b
image: ghcr.io/davidcozens/cpputest-freertos:sha-1cb0f34
options: --user root
env:
GIT_CONFIG_COUNT: 1
Expand Down Expand Up @@ -840,7 +840,7 @@ jobs:
contents: read
checks: write
container:
image: ghcr.io/davidcozens/cpputest-freertos:sha-bbc958b
image: ghcr.io/davidcozens/cpputest-freertos:sha-1cb0f34
options: --user root
env:
GIT_CONFIG_COUNT: 1
Expand Down Expand Up @@ -884,7 +884,7 @@ jobs:
permissions:
contents: read
container:
image: ghcr.io/davidcozens/cpputest-freertos-cross:sha-bbc958b
image: ghcr.io/davidcozens/cpputest-freertos-cross:sha-1cb0f34
options: --user root
env:
GIT_CONFIG_COUNT: 1
Expand Down
22 changes: 19 additions & 3 deletions Bdd/Targets/Common/BddTargetSwitchConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,42 @@
#include <string.h>

static volatile uint8_t selectedIndex;
static volatile bool mtlsMode;

void BddTargetSwitchConfig_SetByName(const char* name)
{
if (strcmp(name, "udp") == 0)
{
selectedIndex = BDD_TARGET_SWITCH_UDP;
mtlsMode = false;
}
else if (strcmp(name, "tcp") == 0)
{
selectedIndex = BDD_TARGET_SWITCH_TCP;
mtlsMode = false;
}
else if ((strcmp(name, "tls") == 0) || (strcmp(name, "mtls") == 0))
else if (strcmp(name, "tls") == 0)
{
/* mTLS shares the reliable/TLS slot; the TLS stream is configured
* with client cert+key at startup when --transport mtls is selected. */
selectedIndex = BDD_TARGET_SWITCH_TLS;
mtlsMode = false;
}
else if (strcmp(name, "mtls") == 0)
{
/* mTLS shares the reliable/TLS slot. The wrapper wires the client
* cert+key at startup regardless of mode, and the TLS sender's
* Endpoint callback dispatches on mtlsMode to pick the right port
* (6514 vs 6515) at Connect time. */
selectedIndex = BDD_TARGET_SWITCH_TLS;
mtlsMode = true;
}
}

uint8_t BddTargetSwitchConfig_Selector(void)
{
return selectedIndex;
}

bool BddTargetSwitchConfig_IsMtlsMode(void)
{
return mtlsMode;
}
8 changes: 8 additions & 0 deletions Bdd/Targets/Common/BddTargetSwitchConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "ExternC.h"

#include <stdbool.h>
#include <stdint.h>

EXTERN_C_BEGIN
Expand All @@ -17,6 +18,13 @@ EXTERN_C_BEGIN

void BddTargetSwitchConfig_SetByName(const char* name);
uint8_t BddTargetSwitchConfig_Selector(void); // NOLINT(modernize-redundant-void-arg) -- C idiom
/* tls and mtls share the same Switching slot (BDD_TARGET_SWITCH_TLS) so
* the TLS sender / TLS stream / underlying TCP socket get reused across
* the two modes. The FreeRTOS BDD target reads this at TLS Connect time
* to pick between the syslog-ng oracle's port 6514 (TLS) and 6515 (mTLS);
* the client cert is wired regardless of mode, so the port is the only
* thing that has to flip. */
bool BddTargetSwitchConfig_IsMtlsMode(void); // NOLINT(modernize-redundant-void-arg) -- C idiom

EXTERN_C_END

Expand Down
Loading
Loading