This is the C implementation of APX.
Online documentation and API reference: c-apx.readthedocs.io
All maintenance work for v0.2 is done on the maintenance_0.2 branch. Latest release is v0.2.8.
A brand new implementation is being developed on branch master. It will remain in alpha stage until release v0.4.0.
- Reference implementation of APX IDL v1.3 and APX VM v2.1.
- Parser
- Compiler
- Virtual Machine
- Port connection count support (server and client).
- Dynamic client support
- Use
apx-nodetogether withapx-controlto dynamically create APX nodes.
- Use
Reference implementation of the APX server. It is highly configurable using a single JSON file.
Security features (optional):
- Cryptographically signed APX node verification (NIST P-256 with SHA-256)
- Use the tool
apx-signto create keys and sign your APX nodes.
- Use the tool
Socket support, logging, and more are enabled in the APX server by adding compile-time extensions. Each extension can be individually configured using JSON (including enable/disable options).
Basic socket server support.
- TCP sockets.
- UNIX Domain sockets.
- Virtual Machine Sockets (VSOCK).
Default settings:
- Listening port:
5000 - Listening file path:
/tmp/apx.socket
Extension Type: Source
TLS socket server.
Default settings:
- Listening port:
5020
Extension Type: Source
Demonstrates the built-in event listener mechanism in apx_core and logs server events to stdout or a log file.
Default settings:
- Logs to stdout.
Extension Type: Sink
Exposes real-time event streaming and interactive diagnostic endpoints for apx-mon and apx-log over TCP, UNIX domain sockets, or TLS.
Default settings:
- Listening port:
5080
Extension Type: Source
- APX-ES clients not yet supported (needs a rewrite from v0.2).
- Static clients not yet supported (needs a rewrite from v0.2).
Static clients use a code generator (see Python APX) to generate C code from APX definition files. The generated code is fast and integrates well with type definitions shared with an AUTOSAR RTE generator. Statically generated clients are supposed to be used together with APX-ES in order to run on small devices that run an RTOS.
Dynamic clients parse an APX definition file at runtime and build small bytecode programs (in-memory) which then execute through a virtual machine (VM). This method has more flexibility since it doesn't require C code to be generated or compiled as an intermediate step. Caching mechanisms are currently being developed for C and C++ (more information later). Dynamic clients are best used on Windows and Linux systems.
c-apx provides CMake support for both Windows (MSVC) and Linux (GCC and Clang).
-
Applications: Standard builds compile the core library (
apx_core), enabled extensions, and the executable applications inapp/:apx-server: The APX server daemon.apx-node: APX node application.apx-control: APX control application.apx-mon: Interactive diagnostic and monitoring client.apx-log: Event stream recording and inspection utility.apx-perf-test: Dedicated APX performance test.apx-sign: Utility for signing APX nodes using ECDSA.
Applications can be built in either
DebugorReleaseconfiguration. -
Unit Tests: A dedicated unit test suite target
apx_unitis available.- Enabled by setting
-DUNIT_TEST=ONat CMake configure time. - Built specifically via
--target apx_unitand executed withctest.
- Enabled by setting
For Windows, use a "Native tools command prompt" from your Visual Studio installation.
# Run unit tests
cmake --preset clang-test && cmake --build --preset clang-test && ctest --preset clang-test
# Address and Undefined Behavior Sanitizers (ASan + UBSan)
# Note: This preset requires a preconfigured pytest virtual environment
cmake --preset clang-asan && cmake --build --preset clang-asan && ctest -V --preset clang-asan
# Thread Sanitizers (TSan)
# Note: This preset requires a preconfigured pytest virtual environment
cmake --preset clang-tsan && cmake --build --preset clang-tsan && ctest -V --preset clang-tsan
# Static Analysis
cmake --preset clang-tidy && cmake --build --preset clang-tidy
# Debug build
cmake --preset clang-debug && cmake --build --preset clang-debug
# Release build
cmake --preset clang-release && cmake --build --preset clang-release# Unit test build
cmake --preset msvc-test
cmake --build --preset msvc-test
ctest --preset msvc-test
# Debug build
cmake --preset msvc-debug
cmake --build --preset msvc-debug
# Release build
cmake --preset msvc-release
cmake --build --preset msvc-release
# Static analysis
cmake --preset msvc-analyze
cmake --build --preset msvc-analyzecmake -S . -B build-test -GNinja -DUNIT_TEST=ON
cmake --build build-test
ctest --test-dir build-test --output-on-failureSee tests/README.md for virtual environment setup.
Requires either clang-debug or clang-release presets to have been prebuilt.
pytest -v -n auto