OpenCyphal / libudpard

A compact implementation of the Cyphal/UDP protocol in C for high-integrity real-time embedded systems
MIT License
10 stars 8 forks source link

Set the maximum number of redundant interfaces #44

Closed pavel-kirienko closed 11 months ago

pavel-kirienko commented 11 months ago

The new libcyphal design proposal has a section that reads like this:

///
/// libcyphal takes advantage of an assumption that a small number of redundant interfaces will be used for any single
/// transport. If this assumption is incorrect then the design of the library's internal will need to change since
/// changing this constant will increase the size of several data structures for all interface types and may cause
/// memory or performance issues. We do not recommend increasing this value beyond 4 although reducing it is acceptable
/// (as long as it is not reduced to 0).
constexpr std::size_t maxRedundantInterfaces = 3;

static_assert(maxRedundantInterfaces > 0, "maxRedundantInterfaces must be greater than 0");
static_assert(maxRedundantInterfaces <= 4,
              "maxRedundantInterfaces should be less than or equal to 4. See documentation for more details.");

@thirtytwobits @lydia-at-amazon Should we increase UDPARD_NETWORK_INTERFACE_COUNT_MAX to 4?

https://github.com/OpenCyphal-Garage/libudpard/blob/75dfe91b1f6ca306a5110c2984186d6c5a97e8e3/libudpard/udpard.h#L240-L241

pavel-kirienko commented 11 months ago

We decided to keep 3