ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
middleware.cpp File Reference

Middleware chain + built-in fixed-window rate limiter for PC. More...

#include "protocore.h"
#include "shared_primitives/mime.h"
#include "shared_primitives/strbuf.h"
#include <stdio.h>

Go to the source code of this file.

Detailed Description

Middleware chain + built-in fixed-window rate limiter for PC.

Split out of protocore.cpp (single-purpose server files). use() registers a middleware; run_middleware() runs the chain in order (first MW_HALT stops dispatch); enable_rate_limit() / rate_limit_check() implement a rollover-safe fixed-window counter that answers 429 + Retry-After past the budget. All four are PC methods over member state - a pure move.

Definition in file middleware.cpp.