Sans-I/O
Bytes and a timestamp in; bytes, events and deadlines out. A whole DC charging session runs as a unit test, with time as a variable.
ISO 15118-2 · ISO 15118-20 · ISO 15118-3
iso15118 is the ISO 15118 protocol suite in pure Rust: a schema-informed EXI codec generated from the official schemas, both generations' message sets including ISO 15118-20 Amd 1, SLAC and SECC discovery, the V2G PKI, and sans-I/O session engines for the vehicle and the charging station alike. No sockets, no clock, no async runtime — those are yours.
cargo add iso15118ISO 15118 is what a car and a DC fast charger speak while deciding whether to move 350 kW between them. One codebase for both roles and both generations, on a charge-point back end and a bare-metal controller alike.
Bytes and a timestamp in; bytes, events and deadlines out. A whole DC charging session runs as a unit test, with time as a variable.
no_std + allocThe core builds for thumbv7em-none-eabihf. Every feature flag gates real code, so a DC-only vehicle controller compiles the DC message set and nothing else.
Every grammar and message is diffed against the EXI reference implementation, as documents and signature fragments, captured sessions from real equipment re-encode byte for byte, and whole sessions run live against Josev and EVerest.
Every length is bounded by its schema facet before anything is allocated, nesting is capped, every decoder is fuzzed, and there is no unsafe.
The engines own framing, decoding, the handshake, session ids, message ordering and the spec timers. Whether to authorize, which schedule to offer and how much current to deliver arrive as events you answer.
handle_input, poll_event, respond, take_transmit, poll_timeout — the same five calls for the charger, the vehicle, discovery and SLAC.FAILED_* response ends the session and leaves only SessionStopReq; the drivers enter that state on their own.let mut secc = Secc::new(SeccConfig {
protocols: Protocols::ISO,
session_id: SessionId::new(*b"\x11\x22\x33\x44\x55\x66\x77\x88"),
..SeccConfig::default()
});
let mut buf = [0u8; 4096];
loop {
let n = read(&mut buf);
secc.handle_input(now(), &buf[..n])?;
while let Some(event) = secc.poll_event() {
match event {
Event::ProtocolAgreed(p) => println!("speaking {p}"),
Event::Request(req) => secc.respond(now(), answer(&req))?,
Event::Refused { .. } => break,
Event::Closed(why) => return Ok(println!("session over: {why}")),
_ => {}
}
}
write(&secc.take_transmit());
}From the powerline link coming up to the charge loop turning.
| Layer | State |
|---|---|
| EXI — schema-informed, bit-packed | Primitives, value string table, grammars, header, documents and fragments |
| V2GTP framing | All payload types, hostile-length handling, bounded stream reassembly |
| SDP discovery | Codec, the vehicle-side retry engine, TLS-downgrade and off-link rejection |
| SLAC — ISO 15118-3 | Frame codec, timers, and the matching state machine for both roles |
| ISO 15118-2 message set | All 34 body messages, ds:Signature included |
| ISO 15118-20 message sets | CommonMessages, AC, DC, WPT, ACDP, and Amd 1's AC_DER_IEC / AC_DER_SAE; MCS on the DC flow |
| Session layer | Clock, spec timers and configurable loop budgets, ordering graphs for both generations, the message-set rule, the ISO 15118-2 charging-profile rule |
| EVCC / SECC drivers | Handshake, sequencing, session-id checks, half-duplex enforcement, pause and resume |
| Plug & Charge signatures | XMLDSig over EXI fragments, build and verify: ECDSA over secp256r1 (-2), secp521r1 and Ed448 (-20) |
| V2G PKI | DER/X.509 reader, RFC 5280 path validation under ISO 15118-2 Annex F and ISO 15118-20 Annex B and Amd 1, OCSP and CRL revocation status, and the contract-key envelopes of both generations |
Named rather than implied.
OCSP responses and CRLs you hand in are verified; nothing here contacts a responder or downloads a list.
No TCP, TLS or raw sockets. Bring rustls on a server and embedded-tls on an ECU; the examples show the glue.
Its message set is not included. The handshake declines DIN by name, and the framing and timers carry a DIN codec of your own.