Skip to main content

Module session

Module session 

Source
Expand description

Client-side session driver that ties the transport, service and ciphering layers into blocking GET/SET/ACTION/associate/release round trips. A client-side session driver tying the transport, service and ciphering layers together (IEC 62056-5-3 / IEC 62056-53 client CF).

crate::session::ClientSession wraps any crate::transport::DataLinkLayer (HDLC or wrapper) and exposes the confirmed COSEM services — association, GET, SET, ACTION, release — as blocking request/response round trips. When a crate::service::ciphering::SecurityContext is configured, request APDUs are protected with global (glo-) ciphering and the matching ciphered responses are transparently unprotected; the client invocation counter is advanced after every protected request.

§Timeouts and retries

Use the ClientSessionBuilder to configure per-request timeouts and automatic retries for transient errors:

let transport = MemoryTransport::new();
let wrapper = Wrapper::new(transport, 1, 1024);
let mut session = ClientSessionBuilder::new(wrapper)
    .request_timeout(std::time::Duration::from_secs(5))
    .max_retries(3)
    .retry_delay(std::time::Duration::from_millis(200))
    .build();

Structs§

AarqBuilder
Builder for AARQ construction with a fluent API.
Ciphers 🔒
The two directional ciphering contexts of a secured session. Each direction has its own initialization-vector stream: outbound APDUs use the client’s system-title and invocation counter, inbound APDUs the server’s. The service-specific glo-ciphering APDU does not carry the originator title, so both titles must be known out of band (from the AARQ/AARE exchange).
ClientSession
A blocking client session over a framing sub-layer L.
ClientSessionBuilder
Builder for creating a ClientSession with custom configuration.
GbtConfig 🔒
General block transfer configuration for a session (IEC 62056-5-3 §9.3): requests/responses whose service qualifies (see gbt::applies_to_apdu) and exceed block_payload_max are segmented into GBT blocks instead of sent as a single frame.
SessionConfig
Configuration for timeouts and retries.

Enums§

AssociationState
Current state of the application association.
SessionError
Errors raised by the session driver.

Functions§

is_transient_io 🔒
Checks if an I/O error is transient and worth retrying.