#[non_exhaustive]pub struct EngineConfig {
pub role: Role,
pub version: Version,
pub call_timeout: Duration,
pub inbound_concurrency: InboundConcurrency,
pub heartbeat: HeartbeatPolicy,
pub retry: RetryPolicy,
pub offline: OfflinePolicy,
pub backoff: Backoff,
pub enforce_boot_gate: bool,
pub boot_retry_fallback: Duration,
pub max_peer_requests: usize,
pub inbound_rate: Option<RateLimit>,
}Expand description
Engine configuration.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.role: RoleWhich side this is.
version: VersionThe negotiated protocol version.
call_timeout: DurationHow long to wait for a CALLRESULT / CALLERROR.
The specification deliberately leaves this implementation-defined (Part 4 §4.1.1);
2.x sources it from NetworkConnectionProfile.messageTimeout, falling back to
OCPPCommCtrlr.MessageTimeout[Default]. 30 s is the widely used default.
inbound_concurrency: InboundConcurrencyWhat to do about a peer that keeps two calls in flight.
heartbeat: HeartbeatPolicyWhether the engine sends Heartbeat itself.
retry: RetryPolicyRetry schedule for transaction-related messages.
offline: OfflinePolicyOffline queueing behaviour.
backoff: BackoffReconnect back-off parameters, for the driver to use (Part 4 §5.4).
enforce_boot_gate: boolWhether the boot state machine gates outgoing calls (B02.FR.02).
Always on for a Charging Station; a CSMS uses it to enforce B02.FR.09.
boot_retry_fallback: DurationHow long to wait before re-sending BootNotification when the CSMS answered
Pending or Rejected with interval = 0 (B02.FR.07).
max_peer_requests: usizeUpper bound on the peer’s simultaneously unanswered CALLs.
The specification allows exactly one (Part 4 §4.1.1), and
InboundConcurrency::Serve deliberately tolerates more — but “more” must still be
finite, or a peer that never stops asking can make the receiver hold requests, and
handler tasks, without limit. Beyond this many the extra call is answered
ProtocolError regardless of InboundConcurrency.
inbound_rate: Option<RateLimit>How often the peer may send unprompted messages; None (the default) for no limit.
Counted: every CALL, SEND, malformed frame and answer to a call that is not
outstanding. Never counted: answers to our own outstanding call, whose rate is ours.
Over the rate, a CALL is answered SecurityError before any other check — it never
becomes an Output::Request or an in-flight call — and everything else is dropped
without an answer or a violation, because answering a flood is what it is for.
Output::RateLimited reports the first refusal of each run.
Implementations§
Source§impl EngineConfig
impl EngineConfig
Sourcepub fn new(role: Role, version: Version) -> Self
pub fn new(role: Role, version: Version) -> Self
A configuration with the specification’s defaults.
Sourcepub const fn with_call_timeout(self, timeout: Duration) -> Self
pub const fn with_call_timeout(self, timeout: Duration) -> Self
Sets the message timeout.
Sourcepub const fn with_retry(self, retry: RetryPolicy) -> Self
pub const fn with_retry(self, retry: RetryPolicy) -> Self
Sets the transaction retry schedule.
Sourcepub const fn with_offline(self, offline: OfflinePolicy) -> Self
pub const fn with_offline(self, offline: OfflinePolicy) -> Self
Sets the offline queueing policy.
Sourcepub const fn with_heartbeat(self, heartbeat: HeartbeatPolicy) -> Self
pub const fn with_heartbeat(self, heartbeat: HeartbeatPolicy) -> Self
Sets the heartbeat policy.
Sourcepub const fn with_inbound_rate(self, rate: RateLimit) -> Self
pub const fn with_inbound_rate(self, rate: RateLimit) -> Self
Limits how often the peer may send unprompted messages. See
inbound_rate.
Sourcepub const fn with_inbound_concurrency(self, mode: InboundConcurrency) -> Self
pub const fn with_inbound_concurrency(self, mode: InboundConcurrency) -> Self
Sets what happens when the peer keeps two calls in flight.