pub trait PolicyEngine: Send + Sync {
// Required methods
fn outbound_decision(&self, ctx: OutboundCtx<'_>) -> PolicyDecision;
fn inbound_decision(&self, ctx: InboundCtx<'_>) -> PolicyDecision;
fn accept_peer(&self, caps: &PeerCapabilities) -> bool;
}Expand description
Policy-Engine: entscheidet fuer ein konkretes (peer, topic, interface)-Tripel das Schutz-Level.
§Safety-Klassifikation
Trait ist Send + Sync, damit er via Arc<dyn PolicyEngine> in
Multi-Thread-Runtime genutzt werden kann. Das triggert
zerodds-lint: allow no_dyn_in_safe (dokumentiert in
08_heterogeneous_security.md §7).
§Default-Contract
- Implementationen muessen deterministisch sein: gleiche Context-Inputs → gleiche Decision. Kein Zufall, keine Zeit-abhaengigen Branches (sonst sind Replay-Angriffe moeglich).
accept_peerdarffalsezurueckgeben, wenn der Peer nicht die Minimal-Anforderungen (z.B. fehlendesauth_plugin_classbei Domain mitallow_unauthenticated_participants=false) erfuellt.outbound_decision/inbound_decisionduerfen nicht blockieren — sie laufen im Hot-Path.
Required Methods§
Sourcefn outbound_decision(&self, ctx: OutboundCtx<'_>) -> PolicyDecision
fn outbound_decision(&self, ctx: OutboundCtx<'_>) -> PolicyDecision
Outbound-Pfad: welches Schutz-Level soll das Wire-Paket haben?
Sourcefn inbound_decision(&self, ctx: InboundCtx<'_>) -> PolicyDecision
fn inbound_decision(&self, ctx: InboundCtx<'_>) -> PolicyDecision
Inbound-Pfad: Paket akzeptieren / droppen / entschluesseln?
Sourcefn accept_peer(&self, caps: &PeerCapabilities) -> bool
fn accept_peer(&self, caps: &PeerCapabilities) -> bool
SEDP-Admission: ist dieser Peer (laut Capabilities) grundsaetzlich akzeptabel fuer einen Match?