|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
Layer: Foundation ยท Build flags: PROTOCORE_ENABLE_DMA, PROTOCORE_ENABLE_PREEMPT_QUEUE, PROTOCORE_ENABLE_FORWARD, PROTOCORE_DMA_SIMULATE
The whole v5 ingest pipeline, end to end. A frame arriving on one interface is forwarded to another, so the device bridges / routes between its interfaces instead of only terminating traffic:
Three pieces snap together, each already its own feature:
services/forward) applies the rules and sends the frame out interface B.Register interfaces (each with an egress send callback), then add src -> dst rules:
(src, dst) pair forwards only with an ALLOW rule and no DENY (a DENY always wins). A frame is never reflected to its source interface.protocore_forward_get_stats()), never blocks.Before any forwarding rule runs, an optional access-control list filters frames by content. Each entry matches on the source interface (or PROTOCORE_FWD_IF_ANY) and a byte pattern under a mask; entries are evaluated in add order, first match wins, and a frame matching none takes the ACL default (permit by default, so the ACL is opt-in):
This sketch drops every 5th frame (a 0xFF marker) at the ACL; watch acl_denied climb in the serial stats while forwarded counts the rest.
Storage is static (zero heap): PROTOCORE_FWD_MAX_RULES rules, PROTOCORE_FWD_MAX_ACL ACL entries and PROTOCORE_FWD_MAX_ROUTES routes. The interfaces are not sized here - an interface is a physical thing, so L1 owns the registry and the forwarding plane reads it.
Here interface A is a DMA channel fed by the simulator (no wire needed) and interface B's egress just counts the bytes; a real build sends B out Wi-Fi / Ethernet / a bus or another DMA channel.
The flags must reach the library build, so pass them as build flags: