iec61850-kit 0.8.1

IEC 61850 in Rust: GOOSE and Sampled Values on capture files and live interfaces, an MMS client and server over the full OSI stack, and SCL loading and editing. Panic-free, sans-IO, no_std-capable.
Documentation
# iec61850-kit

[![CI](https://github.com/hupe1980/iec61850-kit/actions/workflows/ci.yml/badge.svg)](https://github.com/hupe1980/iec61850-kit/actions/workflows/ci.yml)
[![License](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue)](#licence)

IEC 61850 for Rust. Publish and subscribe to GOOSE and Sampled Values, connect to an IED over MMS,
or serve an IED model from an SCL file. The protocol cores support `no_std` with `alloc`. The
blocking client and server accept TCP connections and application-owned streams, including TLS.

[Guide](https://hupe1980.github.io/iec61850-kit/docs/) · [API reference](https://docs.rs/iec61850-kit) · [Changelog](CHANGELOG.md)

## Install

Requires Rust 1.90 or later.

```sh
cargo add iec61850-kit
```

Install the `ied` command line with `brew install hupe1980/tap/ied` or
`cargo install iec61850-kit --features cli`.

## Use it

List the logical devices on a local MMS server:

```rust
use iec61850_kit::client::Client;

fn main() -> iec61850_kit::Result<()> {
    let mut client = Client::connect("127.0.0.1:8102")?;
    for device in client.server_directory()? {
        println!("{device}");
    }
    client.release()
}
```

To try both roles locally with a bundled SCL model, run `cargo run --example server_from_scl`
from a checkout.

## Features

| Task | Guide |
|---|---|
| Publish or subscribe over Ethernet or capture files | [GOOSE]https://hupe1980.github.io/iec61850-kit/docs/goose/ · [Sampled Values]https://hupe1980.github.io/iec61850-kit/docs/sampled-values/ |
| Browse data, receive reports, operate controls, transfer files, query logs or select setting groups | [MMS client]https://hupe1980.github.io/iec61850-kit/docs/mms/ · [Server]https://hupe1980.github.io/iec61850-kit/docs/server/ |
| Read daily FSCH tariffs on a blocking or async MMS association | [Tariff schedules]https://hupe1980.github.io/iec61850-kit/docs/mms/#daily-grid-tariffs |
| Load, validate or edit ICD, CID and SCD files while preserving formatting | [SCL]https://hupe1980.github.io/iec61850-kit/docs/scl/ |
| Simulate an IED or inspect a capture from the shell | [CLI reference]https://hupe1980.github.io/iec61850-kit/docs/cli/ |

## Verification

Run `cargo test --all-features` from a checkout. Capture, Wireshark and Docker tests need
their respective fixtures or tools. The verification guide lists the tested peers, allocation
measurements and hardware limitations. The crate has no IEC conformance certificate.
[Verification](https://hupe1980.github.io/iec61850-kit/docs/verification/)

## Develop

```bash
cargo test --all-features                     # captures, tshark and Docker tests skip if absent

cargo test --all-features --test interop     # needs Docker; builds the peer images on first use
scripts/linux-test.sh --docker                # live GOOSE/SV over a veth pair, in a container

SIM_SEED=42 cargo test --test simulation      # replay one simulation seed
cargo +nightly fuzz run mms_association -- -max_total_time=60
cargo test --test regressions                 # every input a fuzzer once crashed on
cargo build --no-default-features --features goose,sv,mms --target thumbv7em-none-eabihf
```

IEC standards are copyrighted and are not part of this repository.
`scripts/fetch-references.sh` fetches the freely available material — ITU-T recommendations,
RFCs, public standard previews, sample captures and OpenSCD test fixtures — into a local
reference corpus (`IEC61850_REFERENCE` chooses where). Tests that need it skip when it is
absent.

## Licence

Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or
[MIT license](LICENSE-MIT) at your option.

An independent implementation, not affiliated with or endorsed by the IEC.