# bardasz/etp-rs architecture

> Architecture diagram of the GitHub repository bardasz/etp-rs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bardasz/etp-rs
- Repository: https://github.com/bardasz/etp-rs

## Overview

etp-rs is an ETP 1.2 Rust client library. Its main runtime path is client configuration and session negotiation, followed by framed message exchange with an ETP server; the included example performs resource discovery. Protocol schemas and Rust message types provide serialization support. The excerpts show session framing and negotiation, but not the complete schema-loading or broader protocol-call implementations, so those relationships are limited to directly visible references.

Main entry points: [`src/session.rs`](https://github.com/bardasz/etp-rs/blob/main/src/session.rs) (Session transport), [`src/lib.rs`](https://github.com/bardasz/etp-rs/blob/main/src/lib.rs) (Client entry point), [`src/schema_extensions.rs`](https://github.com/bardasz/etp-rs/blob/main/src/schema_extensions.rs) (Session defaults), [`src/schema.rs`](https://github.com/bardasz/etp-rs/blob/main/src/schema.rs) (Message schemas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_connection["Connection and session"]
  node_library["Client entry point<br/>[lib.rs]"]
  node_session["Session transport<br/>[session.rs]"]
end

subgraph group_protocol["Protocol encoding"]
  node_msg_schema["Message schemas<br/>[schema.rs]"]
  node_schema_extensions["Session defaults"]
  node_header_flags["Header flags<br/>[headerflags.rs]"]
  node_helpers["Time conversion<br/>[helpers.rs]"]
  node_errors["Client errors<br/>[error.rs]"]
end

subgraph group_types["ETP message types"]
  node_protocol_types["Protocol message types<br/>[schema_gen.rs]"]
  node_data_types["ETP data types<br/>[struct.rs]"]
  node_schemas["ETP schema files"]
end

node_client(("Client application"))
node_server["ETP server"]

node_client -->|"uses"| node_library
node_library -->|"opens session"| node_session
node_library -->|"requests capabilities"| node_server
node_session -->|"exchanges frames"| node_server
node_session -->|"encodes messages"| node_msg_schema
node_session -->|"sets flags"| node_header_flags
node_session -->|"returns errors"| node_errors
node_library -->|"sends requests"| node_protocol_types
node_msg_schema -->|"uses message types"| node_protocol_types
node_schema_extensions -->|"interprets flags"| node_header_flags
node_schema_extensions -->|"converts time"| node_helpers

click node_library "https://github.com/bardasz/etp-rs/blob/main/src/lib.rs"
click node_session "https://github.com/bardasz/etp-rs/blob/main/src/session.rs"
click node_msg_schema "https://github.com/bardasz/etp-rs/blob/main/src/schema.rs"
click node_schema_extensions "https://github.com/bardasz/etp-rs/blob/main/src/schema_extensions.rs"
click node_header_flags "https://github.com/bardasz/etp-rs/blob/main/src/headerflags.rs"
click node_helpers "https://github.com/bardasz/etp-rs/blob/main/src/helpers.rs"
click node_errors "https://github.com/bardasz/etp-rs/blob/main/src/error.rs"
click node_protocol_types "https://github.com/bardasz/etp-rs/blob/main/src/schema_gen.rs"
click node_data_types "https://github.com/bardasz/etp-rs/blob/main/schema/struct.rs"
click node_schemas "https://github.com/bardasz/etp-rs/tree/main/schema/etp12"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_library,node_session,node_client toneBlue
class node_msg_schema,node_schema_extensions,node_header_flags,node_helpers,node_errors toneAmber
class node_protocol_types,node_data_types,node_schemas,node_server toneMint
```

## Components

### Connection and session

- [Client entry point](https://github.com/bardasz/etp-rs/blob/main/src/lib.rs): `src/lib.rs`
- [Session transport](https://github.com/bardasz/etp-rs/blob/main/src/session.rs): `src/session.rs`

### Protocol encoding

- [Message schemas](https://github.com/bardasz/etp-rs/blob/main/src/schema.rs): `src/schema.rs`
- [Session defaults](https://github.com/bardasz/etp-rs/blob/main/src/schema_extensions.rs): `src/schema_extensions.rs`
- [Header flags](https://github.com/bardasz/etp-rs/blob/main/src/headerflags.rs): `src/headerflags.rs`
- [Time conversion](https://github.com/bardasz/etp-rs/blob/main/src/helpers.rs): `src/helpers.rs`
- [Client errors](https://github.com/bardasz/etp-rs/blob/main/src/error.rs): `src/error.rs`

### ETP message types

- [Protocol message types](https://github.com/bardasz/etp-rs/blob/main/src/schema_gen.rs): `src/schema_gen.rs`
- [ETP data types](https://github.com/bardasz/etp-rs/blob/main/schema/struct.rs): `schema/struct.rs`
- [ETP schema files](https://github.com/bardasz/etp-rs/tree/main/schema/etp12): `schema/etp12`

### Other components

- **Client application**
- **ETP server**

## Connections

- Client application → Client entry point: uses (evidence: `README.md`)
- Client entry point → Session transport: opens session (evidence: `src/lib.rs`)
- Client entry point → ETP server: requests capabilities (evidence: `src/lib.rs`)
- Session transport → ETP server: exchanges frames (evidence: `src/session.rs`)
- Session transport → Message schemas: encodes messages (evidence: `src/session.rs`)
- Session transport → Header flags: sets flags (evidence: `src/session.rs`)
- Session transport → Client errors: returns errors (evidence: `src/session.rs`)
- Client entry point → Protocol message types: sends requests (evidence: `src/lib.rs`)
- Message schemas → Protocol message types: uses message types (evidence: `src/schema.rs`)
- Session defaults → Header flags: interprets flags (evidence: `src/schema_extensions.rs`)
- Session defaults → Time conversion: converts time (evidence: `src/schema_extensions.rs`)
