|
Comms CCF
This is a simple communication layer based on COBS, CBOR and FNV-1A
|
Remote procedure support. More...
#include "cbor.hpp"#include "comptime_str.hpp"#include "ndebug.hpp"#include <stddef.h>#include <stdint.h>#include <array>#include <functional>#include <span>#include <string_view>#include <tuple>#include <utility>#include "debug_end.hpp"Go to the source code of this file.
Classes | |
| struct | Type< T > |
| struct | Type< I > |
| struct | Type< std::string_view > |
| struct | Type< std::span< uint8_t, extent > > |
| struct | Type< std::tuple<> > |
| struct | Type< std::tuple< Ts... > > |
| class | NonTemplatedCall |
| class | Call< Ret, Args > |
| class | Rpc< Calls > |
Macros | |
| #define | self (*this) |
| #define | self_arg(type) |
| #define | self_app(value) |
| #define | prototype(ret, name, args) |
| #define | definition(ret, name, args) |
| #define | LITERAL_COMPTIME_STRING(name, value) |
Remote procedure support.
We can have remote code execution very simply: read a function pointer, then a list of arguments (e.g. CBOR encoded), and jump to that pointer with the arguments on the stack. This is tedious and fragile, however.
The tedium we can help by using e.g. Python to do some of the sending data, and the fragility we can help by defining at compile-time which functions we want to be exposed, and also doing type checking on those argumets.
We can further help the tedium and safety by transmitting a schema that the endpoint supports. This way we can do checking at the Python level even before we send data out.
Using template metaprogramming, we can also have type safety in C++.
| #define definition | ( | ret, | |
| name, | |||
| args ) |
| #define LITERAL_COMPTIME_STRING | ( | name, | |
| value ) |
| #define prototype | ( | ret, | |
| name, | |||
| args ) |
| #define self_app | ( | value | ) |
| #define self_arg | ( | type | ) |